your project is an effort to add those remaining
features to Boost Ranges?
I mean to.
I don't understand the "|+" usage at all.
"|+" is oven::regular() function's syntax sugar version.
regular() is needed when using lambda(C++0x and BLL) in Range adaptor.
Lambda is NonDefaultConstructible and NonCopyAssignable. regular()
convert lambda into DefaultConstructible and CopyAssignable.
Lambda becomes a problem in the following case:
template
F for_each(Iterator first, Iterator last, F f)
{
Iterator it; // DefaultConstruct
it = first; // CopyAssign
for (; it != last; ++it)
f(*it);
return f;
}
template
F for_each(const Range& r, F f)
{
return for_each(boost::begin(r), boost::end(r), f);
}
for_each(v | filtered(_1 % 2 == 0)); // error! filter_iterator is
NonDefaultConstructible and NonCopyAssignable
This problem solve by regular() :
for_each(v | filtered(regular(_1 % 2 == 0))); // OK, but verbose...
But since regular() was verbose, it prepared the short notation: "operator|+"
for_each(v |+ filtered(_1 % 2 == 0)); // OK
========================
Akira Takahashi
mailto : faithandbrave@gmail.com
blog : http://d.hatena.ne.jp/faith_and_brave/