1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 4<title>Macro BOOST_TTI_TRAIT_HAS_TEMPLATE</title> 5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="Chapter 1. The Type Traits Introspection Library"> 8<link rel="up" href="header/boost/tti/has_template_hpp.html" title="Header <boost/tti/has_template.hpp>"> 9<link rel="prev" href="header/boost/tti/has_template_hpp.html" title="Header <boost/tti/has_template.hpp>"> 10<link rel="next" href="BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 15<td align="center"><a href="../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_TTI_HAS_TEMPLATE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="refentry"> 26<a name="BOOST_TT_idm46187185686608"></a><div class="titlepage"></div> 27<div class="refnamediv"> 28<h2><span class="refentrytitle">Macro BOOST_TTI_TRAIT_HAS_TEMPLATE</span></h2> 29<p>BOOST_TTI_TRAIT_HAS_TEMPLATE — Expands to a metafunction which tests whether an inner class template with a particular name exists. </p> 30</div> 31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="header/boost/tti/has_template_hpp.html" title="Header <boost/tti/has_template.hpp>">boost/tti/has_template.hpp</a>> 33 34</span>BOOST_TTI_TRAIT_HAS_TEMPLATE(trait, ...)</pre></div> 35<div class="refsect1"> 36<a name="idm45456560424288"></a><h2>Description</h2> 37<p>trait = the name of the metafunction. ... = variadic parameters. The first variadic parameter is the inner class template name. 38 39 Following variadic parameters are optional. 40 41 If no following variadic parameters exist, then the inner class template 42 being introspected must be all template type parameters ( template parameters 43 starting with `class` or `typename` ) and any number of template type parameters 44 can occur. 45 46 If the second variadic parameter is BOOST_PP_NIL and no other variadic 47 parameter is given, then just as in the previous case the inner class template 48 being introspected must be all template type parameters ( template parameters 49 starting with `class` or `typename` ) and any number of template type parameters 50 can occur. This form is allowed in order to be consistent with using the 51 non-variadic form of this macro. 52 53 If the second variadic parameter is a Boost preprocessor library array and no other 54 variadic parameter is given, then the inner class template must have its template 55 parameters matching the sequence in the tuple portion of the Boost PP array. This 56 form is allowed in order to be consistent with using the non-variadic form of this 57 macro. 58 59 Otherwise the inner class template must have its template parameters matching the 60 sequence of the optional variadic parameters. 61</p> 62<p>generates a metafunction called "trait" where 'trait' is the first macro parameter. template<class BOOST_TTI_TP_T> 63 struct trait 64 { 65 static const value = unspecified; 66 typedef mpl::bool_<true-or-false> type; 67 }; 68 69 The metafunction types and return: 70 71 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 72 73 returns = 'value' is true if the 'name' template exists within the enclosing type, 74 otherwise 'value' is false. 75</p> 76<p>Examples:</p> 77<p>1) Search for an inner class template called 'MyTemplate', with all template type parameters, nested within the class 'MyClass' using a metafunction name of 'MyMeta'.</p> 78<p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate)</p> 79<p>or</p> 80<p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,BOOST_PP_NIL) // Non-variadic macro form</p> 81<p>MyMeta<MyClass>::value</p> 82<p>is a compile time boolean constant which is either 'true' or 'false' if the nested template exists.</p> 83<p>2) Search for an inner class template called 'MyTemplate', with template parameters of 'class T,int x,template<class> class U', nested within the class 'MyClass' using a metafunction name of 'MyMeta'.</p> 84<p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,class,int,template<class> class)</p> 85<p>or</p> 86<p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,(3,(class,int,template<class> class))) // Non-variadic macro form</p> 87<p>MyMeta<MyClass>::value</p> 88<p>is a compile time boolean constant which is either 'true' or 'false' if the nested template exists. </p> 89</div> 90</div> 91<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 92<td align="left"></td> 93<td align="right"><div class="copyright-footer">Copyright © 2011-2013 Tropic Software 94 East Inc<p> 95 Distributed under the Boost Software License, Version 1.0. (See accompanying 96 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 97 </p> 98</div></td> 99</tr></table> 100<hr> 101<div class="spirit-nav"> 102<a accesskey="p" href="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_TTI_HAS_TEMPLATE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 103</div> 104</body> 105</html> 106