K
Kevin Ruland
Hi all.
I have a template class with conversion operator:
template< typename T >
class FooWrapper {
public:
FooWrapper( const T& rhs );
}
Along with some specializations for this:
template<>
class FooWrapper<MyType> {
public:
FooWrapper( const MyType& rhs );
}
and so forth.
Now I'm defining some operators using templates which I want to be
limited to only FooWrapper<T> classes.
template<typename T, typename U>
int
operator+ (const FooWrapper<T>&, const FooWrapper<T>& );
The problem I'm having is compiling code like this:
MyType a, b;
int i = a + b;
Under g++ 3.2.3.20030502 it states there is no operator+ for MyType&,
MyType&.
Really, my question is why are the user defined conversions not
considered when trying to match with the customer operator+?
Thanks much.
Kevin Ruland
I have a template class with conversion operator:
template< typename T >
class FooWrapper {
public:
FooWrapper( const T& rhs );
}
Along with some specializations for this:
template<>
class FooWrapper<MyType> {
public:
FooWrapper( const MyType& rhs );
}
and so forth.
Now I'm defining some operators using templates which I want to be
limited to only FooWrapper<T> classes.
template<typename T, typename U>
int
operator+ (const FooWrapper<T>&, const FooWrapper<T>& );
The problem I'm having is compiling code like this:
MyType a, b;
int i = a + b;
Under g++ 3.2.3.20030502 it states there is no operator+ for MyType&,
MyType&.
Really, my question is why are the user defined conversions not
considered when trying to match with the customer operator+?
Thanks much.
Kevin Ruland