[fusion] probably a bug in result_of::join
This is nearly a copy-paste from the doc (and agrees with intuition):
#include
Yeah, this is a major issue of the current fusion implementation. The result_of::-metafunctions do not regard that the actual functions take const-qualified arguments only. On top of that the documentation is outdated and misleading. In your particular case result_of::join< vector<> const, vector<> const>::type j = join(v1, v2); should work fine. My C++0x port of fusion introduces non-const arguments for the algorithm functions and a new result_of::-concept which allows passing (optionally) cv and ref qualified types. -Christopher jl schrieb:
This is nearly a copy-paste from the doc (and agrees with intuition): #include
#include #include void foo() { using namespace boost::fusion; vector<> v1, v2; result_of::join< vector<>, vector<> >::type j = join(v1, v2); } ...but it doesn't compile (msvc9, boost 1.40): c:\UserTemp\x54209\BoostTests\Any\main.cpp(20) : error C2440: 'initializing' : cannot convert from 'boost::fusion::result_of::join ::type' to 'boost::fusion::joint_view ' with [ LhSequence=const boost::fusion::vector<>, RhSequence=const boost::fusion::vector<> ] and [ Sequence1=boost::fusion::vector<>, Sequence2=boost::fusion::vector<> ] No constructor could take the source type, or constructor overload resolution was ambiguous J-L
Christopher Schmidt writes:
Yeah, this is a major issue of the current fusion implementation. The result_of::-metafunctions do not regard that the actual functions take const-qualified arguments only. On top of that the documentation is outdated and misleading.
Well you could make functions, metafunctions and doc agree like this:
namespace result_of
{
template
My C++0x port of fusion introduces non-const arguments for the algorithm functions and a new result_of::-concept which allows passing (optionally) cv and ref qualified types.
Do you plan to support that in the version for the "old" compilers as well? J-L
comments inline... jl schrieb:
Christopher Schmidt writes:
Yeah, this is a major issue of the current fusion implementation. The result_of::-metafunctions do not regard that the actual functions take const-qualified arguments only. On top of that the documentation is outdated and misleading.
Well you could make functions, metafunctions and doc agree like this:
namespace result_of { template
struct join { typedef joint_view< typename add_const<LhSequence>::type, typename add_const<RhSequence>::type > type; }; }
That's what probably best. This change would not break backwards compatibility and it would add a fair amount of comfort to fusion. I am in favour of adding this to the trunk.
My C++0x port of fusion introduces non-const arguments for the algorithm functions and a new result_of::-concept which allows passing (optionally) cv and ref qualified types.
Do you plan to support that in the version for the "old" compilers as well? J-L
Of course. In fact, the code base is pretty much the same for both, c++0x and non-c++0x supporting compiler. At the moment, compilers such as the gcc 3.x line and MSVC >=7.1 are already fully supported. -Christopher
participants (2)
-
Christopher Schmidt
-
jl