Re: Function Overload for tr1::tuple<T>, How To?
Terry G wrote:
If only is_tuple<T> existed in typetraits...
Why? Any test for a template specialization, such as an is_tuple type
trait, invariably has a trivial (though possibly a somewhat verbose)
implementation:
template <class T>
struct is_tuple
{
static const bool value = false;
};
template <class T1, class T2, class T3, class T4, class T5,
class T6, class T7, class T8, class T9, class T10>
struct is_tuple<T1, T2, T3, T4, T5,
T6, T7, T8, T9, T10>
{
static const bool value = true;
};
So instead of cluttering type_traits with class templates like
is_tuple, is_vector, is_map, and so on ad infinitum, it's up to the
program to implement on its own any single class type trait test that
may be needed.
If only there were default template parameters...
C++ does support default template type parameters in class template
declarations. C++0X adds support for default type parameters in
function template declarations as well.
If only compilers would inline when I tell them to...
Often a C++ compiler will inline function calls only after
optimizations have been enabled (and debugging support has been
disabled). Many C++ compilers also provide a "force inline" directive
to overrule the compiler's default inlining behavior, but in general
inlining is a decison best left up to the compiler.
Greg
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]