Mercurial > hg > octave-lyh
changeset 8726:0f6683a8150a
some comments for lo-traits.h
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 12 Feb 2009 03:03:59 -0500 |
parents | d5af326a3ede |
children | 5a5dbdacbf5d |
files | liboctave/lo-traits.h |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/lo-traits.h +++ b/liboctave/lo-traits.h @@ -23,6 +23,12 @@ #if !defined (octave_liboctave_traits_h) #define octave_liboctave_traits_h 1 +// Ideas for these classes taken from C++ Templates, The Complete +// Guide by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley +// (2003). + +// Select a type based on the value of a constant expression. + template <bool cond, typename T1, typename T2> class if_then_else; @@ -42,6 +48,8 @@ typedef T2 result; }; +// Determine whether a template paramter is a class type. + template<typename T1> class is_class_type { @@ -62,6 +70,9 @@ enum { no = ! yes }; }; +// Define typename ref_param<T>::type as T const& if T is a class +// type. Otherwise, define it to be T. + template<typename T> class ref_param {