Boost logo

Boost :

Subject: Re: [boost] Range begin/end and Fusion begin/end
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-03-19 12:12:09


Steven Watanabe wrote:

>> Of course, keeping the names begin and end for fusion means we won't
>> be able to have a range that is at the same time a fusion sequence,
>> even though that could be somewhat useful.
>
> Hmm. I think it works just fine for boost::array, since fusion::begin
> won't be found by ADL.

It *may* be found by ADL. Consider the following:

#include <boost/array.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/adapted/array.hpp>
#include <boost/range.hpp>

int main()
{
     boost::array<boost::fusion::vector<>, 42> foo;
     begin(foo); // ambiguous, boost::begin or boost::fusion::begin
}

Namespaces of template arguments are also considered for ADL. (Yes,
that's a terrible rule -- no idea why it was coined)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk