Boost logo

Boost :

From: Michael Marcin (mike_at_[hidden])
Date: 2006-11-20 05:06:27


Hi,

I've been toying around with the idea of using fusion in my geometry
library (at least that seems to be the terminology in use around here).
I started reading the documentation and I ran into a problem with the
firs thing I tried to do.

#include <boost/array.hpp>
#include <boost/fusion/iterator.hpp>
#include <boost/fusion/sequence.hpp>
#include <iostream>

int main()
{
     namespace fusion = boost::fusion;
     boost::array<float,3> position = { {0.f, 1.f, 2.f} };
     std::cout << deref( fusion::begin(position) ) << std::endl;
     return 0;
}

fails to compile with:

------------------------------------------------------

main.cpp
c:\code\boost-head\boost\boost\fusion\sequence\adapted\array\array_iterator.hpp(62)
: error C2676: binary '[' : 'boost::array<T,N>' does not define this
operator or a conversion to a type acceptable to the predefined operator
         with
         [
             T=float,
             N=3
         ]
 
c:\code\boost-head\boost\boost\fusion\sequence\adapted\array\array_iterator.hpp(61)
: while compiling class template member function 'float
&boost::fusion::array_iterator<Array,Pos>::deref<Iterator>::call(const
Iterator &)'
         with
         [
             Array=boost::array<float,3>,
             Pos=0,
             Iterator=boost::fusion::array_iterator<boost::array<float,3>,0>
         ]
         c:\code\boost-head\boost\boost\fusion\iterator\deref.hpp(35) :
see reference to class template instantiation
'boost::fusion::array_iterator<Array,Pos>::deref<Iterator>' being compiled
         with
         [
             Array=boost::array<float,3>,
             Pos=0,
             Iterator=boost::fusion::array_iterator<boost::array<float,3>,0>
         ]
         c:\code\boost-head\boost\boost\fusion\iterator\deref.hpp(54) :
see reference to class template instantiation
'boost::fusion::extension::deref_impl<boost::fusion::iterator_facade_tag>::apply<Iterator>'
being compiled
         with
         [
             Iterator=boost::fusion::array_iterator<boost::array<float,3>,0>
         ]
         c:\code\geometry\source\main.cpp(95) : see reference to class
template instantiation 'boost::fusion::result_of::deref<Iterator>' being
compiled
         with
         [
             Iterator=boost::fusion::array_iterator<boost::array<float,3>,0>
         ]

------------------------------------------------------

changing deref::call from:
return it.array[Iterator::index::value];
to:
return it.array.at( Iterator::index::value );

causes it to compile so I'm thinking it is a compiler bug that needs to
be worked around.


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