This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ template parameter constraints


If you are interested in C++ template hacking or the C++ compile-time
reflection branch, then you may want to read my web page on template
parameter constraints:

http://m17n.org/martin/writings/template-parameter-constraints.html

(feedback desired)

Obgcc:
Nathan fixed the following bug

c++/9053: g++ confused about ambiguity of overloaded function templates

Basically, g++ used to consider the following overloaded function
templates ambiguous.

template <class T> typename bar<T>::type foo (T);
template <class T> typename qux<T>::type foo (T);

This has now been fixed in g++ 3.3 (thanks Nathan), but what about
earlier versions?

Here I'd like to point out the following workaround for gcc 3.2:

namespace Dummy1 { template <class T> typename bar<T>::type foo (T); }
namespace Dummy2 { template <class T> typename qux<T>::type foo (T); }
using Dummy1::foo;
using Dummy2::foo;

This is described in greater detail at the above web page.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]