Ovanes Markarian writes:
I posted the following message http://lists.boost.org/boost-users/2006/06/20271.php a few days ago, but did not get any replies.
I know there is an error in the const_ref class. But nevertheless the problem which occures is that my class accepts a vector of supported types as template parameter.
It has two constructors (no default ctor):
template<class Seq_> class my_class { public: typedef my_class<Seq_> this_type;
explicit inline my_class(const this_type& copy_from) :... {...}
template<class TypeFromVector> explicit inline my_class(typename const_ref<TypeFromVector>::type inst) :... {...} };
Now if I try to initialize my_class with type declared in vector I get an error:
error C2664: 'discriminated_union<Seq_>::discriminated_union(const discriminated_union<Seq_> &)' : cannot convert parameter 1 from 't1' to 'const discriminated_union<Seq_> &' with [ Seq_=types_vector ] Reason: cannot convert from 't1' to 'const discriminated_union<Seq_>' with [ Seq_=types_vector ] No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
In the context of overload resolution, any dependent type expression in a form of typename something<T, ...>::type is "non-deducible", meaning that 'T' etc. has to be explicitly specified or deduced from another argument(s), or the function template won't even be considered for forming the list of candidate functions. See 14.8.2 [temp.over] and 14.8.3 [temp.over] for more details. HTH, -- Aleksey Gurtovoy MetaCommunications Engineering