Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] C arrays in fusion::vector
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2009-10-10 18:22:19


Jean-Louis Leroy schrieb:
> msvc9+fusion 1.40 reject this:
>
> fusion::vector<int, char[20]> v;
>
> 1>C:\Users\JLL\Documents\Visual Studio
> 2008\Projects\boost_1_40_0\boost/fusion/container/vector/detail/vector_n.hpp(43)
> : error C2440: '<function-style-cast>' : cannot convert from 'int' to
> 'char [20]'
> 1> There are no conversions to array types, although there are
> conversions to references or pointers to arrays
> 1> C:\Users\JLL\Documents\Visual Studio
> 2008\Projects\boost_1_40_0\boost/fusion/container/vector/detail/vector_n.hpp(42)
> : while compiling class template member function
> 'boost::fusion::vector_data2<Derived,T0,T1>::vector_data2(void)'
> 1> with
> 1> [
> 1> Derived=boost::fusion::vector2<int,char [20]>,
> 1> T0=int,
> 1> T1=char [20]
> 1> ]
>
> Am I doing something wrong ?
>
> Anyway I can wrap the C array in a class (template)...
>
> Thanks,
> J-L

That's because fusion containers internally initialize their elements in
the default constructor via e0(T0()),...eN-1(TN-1()).
I consider this to be a bug, fusion containers should initialize their
elements analogue to std::pair and std::tuple simply via m0(),...mN-1().

-Christopher


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net