On Jan 23, 1:33 pm, "Noah Roberts" <roberts.n...@g mail.comwrote:
whenever it is possible to convert Y to X.You could use a combination of enable_if, is_pointer, and
is_base_of...ma ybe something like so:
template < typename other_val_type >
enable_if
<
mpl::and_
<
is_pointer<valu e_type>
, is_pointer<othe r_val_type>
, is_base_of<valu e_type, other_val_type>
>
, vector &
// HERE
operator = ( vector<other_va l_typeconst & right)
{
...??
}
I don't normally respond to people that email me instead of posting to
the group but I decided in this case I would. Someone asked me two
questions:
1) Are these standard components or did I just make them up?
It is a combination of standard stuff and things that are found in
certain boost libraries. Some of it, including the is_pointer and
is_base_of traits, will be in the next standard. These are basic
metaprogramming techniques but if you've never seen metaprogramming it
might be rather difficult to understand.
2) Where does the last go?
Apparently google groups removed it. It should be on the line after
vector& and before "operator", I put it back.
Now, newsgroup etiquette says you post your replies to the group, not
the user. This is not only because it might be considered rude but so
that others can see the answer...now you know.