The UsageBOOST_AUTO(var,expr) BOOST_AUTO_TPL(var,expr) Arguments
Remarks
If you want to use Sample Codeint main() { length::meter a(5); force::newton b(6); BOOST_AUTO(c, a * b); }
The
The Usage#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() Remarksspecified once in every cpp/hpp file where any registration is performed, before any registration. Sample Code#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() class X; BOOST_TYPEOF_REGISTER_TYPE(X)
The
Useful for UsageBOOST_TYPEOF_INTEGRAL(x) Arguments
RemarksA short syntax has been implemented for the built in types (int, bool, long, unsigned long, etc.) Other non-type template parameters (e.g. pointer to member) are not supported. Sample Code#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() namespace foo { enum color {red, green, blue}; template<color C0,typename T1> class class_with_enum {}; template<typename T0,T0 I1> class class_with_dependent_non_type {}; } BOOST_TYPEOF_REGISTER_TEMPLATE(foo::class_with_enum, (BOOST_TYPEOF_INTEGRAL(foo::color)) (typename) ) BOOST_TYPEOF_REGISTER_TEMPLATE(foo::class_with_dependent_non_type, (typename) (BOOST_TYPEOF_INTEGRAL(P0)) )
The
The
The UsageBOOST_TYPEOF_REGISTER_TYPE(x) Arguments
RemarksMust be used in the global namespace Sample Code#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() namespace foo { class bar {}; enum color {red, green, blue}; } BOOST_TYPEOF_REGISTER_TYPE(foo::bar) BOOST_TYPEOF_REGISTER_TYPE(foo::color)
The UsageBOOST_TYPEOF_REGISTER_TEMPLATE(x, n) BOOST_TYPEOF_REGISTER_TEMPLATE(x, seq) Arguments
RemarksMust be used in the global namespace. The library allows registration of templates with type, integral, and template template parameters:
Sample Code#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() namespace foo { template<typename T0, typename T1> class simple_template {}; template<typename T0, int I1> class class_with_integral_constant {}; } BOOST_TYPEOF_REGISTER_TEMPLATE(foo::simple_template, 2) BOOST_TYPEOF_REGISTER_TEMPLATE(foo::class_with_integral_constant, (typename)(int))
The UsageBOOST_TYPEOF_TEMPLATE(n) BOOST_TYPEOF_TEMPLATE(seq) Arguments
RemarksCan not be used to register nested template template parameters. Sample Code#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() namespace foo { enum color {red, green, blue}; template<color C0, template<typename> class T1> class nested_template_class {}; template<template<typename, unsigned char> class T1> class nested_with_integral {}; } BOOST_TYPEOF_REGISTER_TEMPLATE(foo::nested_template_class, (foo::color) (BOOST_TYPEOF_TEMPLATE(1)) ) BOOST_TYPEOF_REGISTER_TEMPLATE(foo::nested_with_integral, (BOOST_TYPEOF_TEMPLATE((typename)(unsigned char))) )
The UsageBOOST_TYPEOF(expr) BOOST_TYPEOF_TPL(expr) Arguments
Remarks
If you want to use Sample Codetemplate<typename A, typename B> struct result_of_conditional { typedef BOOST_TYPEOF_TPL(true?A():B()) type; }; template<typename A, typename B> result_of_conditional<A, B>::type min(const A& a,const B& b) { return a < b ? a : b; }
The UsageBOOST_TYPEOF_NESTED_TYPEDEF(name,expr) BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) Arguments
Remarks
'typeof_nested_typedef' nests the 'typeof' operation inside a struct. By
doing this, the 'typeof' operation can be split into two steps, deconfusing
several compilers (notably VC7.1 and VC8.0) on the way. This also removes
the limitation imposed by
If you want to use 'typeof_nested_typedef' can not be used at function/block scope. Sample Codetemplate<typename A, typename B> struct result_of_conditional { BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested,true?A():B()) typedef typename nested::type type; }; template<typename A, typename B> result_of_conditional<A, B>::type min(const A& a,const B& b) { return a < b ? a : b; } |