Strange compiler behaviour with mpl::vector

Hello all!
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
::type
{};
I can understand that the compiler is unable to make a decision which ctor
to use, but I do not get an ambiguaty error. It seems like the compiler
simply quits expanding templates and uses the last most successful ctor
matched before the error. This happens only when I use mpl::vector templated
type in conjunction with templated ctor. Other types like below work fine:
template

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
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
::discriminated_union(const discriminated_union &)' : cannot convert parameter 1 from 't1' to 'const discriminated_union &' with [ Seq_=types_vector ] Reason: cannot convert from 't1' to 'const discriminated_union ' 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
participants (2)
-
Aleksey Gurtovoy
-
Ovanes Markarian