diff options
Diffstat (limited to 'tools/auto_index')
70 files changed, 35241 insertions, 0 deletions
diff --git a/tools/auto_index/build/Jamfile.v2 b/tools/auto_index/build/Jamfile.v2 new file mode 100644 index 0000000000..2c229f2ef8 --- /dev/null +++ b/tools/auto_index/build/Jamfile.v2 @@ -0,0 +1,33 @@ +import quickbook ; +import modules ; + +exe auto_index : + ../src/auto_index.cpp + ../src/file_scanning.cpp + ../src/index_generator.cpp + ../src/tiny_xml.cpp + /boost//regex + /boost//filesystem + /boost//system + /boost//program_options +: <define>BOOST_ALL_NO_LIB=1 <link>static release ; + +install aii : auto_index : <location>. ; +install i : auto_index : <location>../../../dist/bin ; + + + + + + + + + + + + + + + + + diff --git a/tools/auto_index/doc/Jamfile.v2 b/tools/auto_index/doc/Jamfile.v2 new file mode 100644 index 0000000000..e510b7dffb --- /dev/null +++ b/tools/auto_index/doc/Jamfile.v2 @@ -0,0 +1,86 @@ +# Copyright John Maddock 2005. Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +using quickbook ; +using auto-index ; +import modules ; + +path-constant images_location : html ; + +xml auto_index : auto_index.qbk ; + +boostbook standalone + : + auto_index + : + # Path for links to Boost: + <xsl:param>boost.root=../../../.. + # Path for libraries index: + <xsl:param>boost.libraries=$(boost-root)/libs/libraries.htm + + # Some general style settings: + <xsl:param>table.footnote.number.format=1 + <xsl:param>footnote.number.format=1 + + # HTML options first: + # Use graphics not text for navigation: + <xsl:param>navig.graphics=1 + # How far down we chunk nested sections, basically all of them: + <xsl:param>chunk.section.depth=10 + # Don't put the first section on the same page as the TOC: + <xsl:param>chunk.first.sections=1 + # How far down sections get TOC's + <xsl:param>toc.section.depth=10 + # Max depth in each TOC: + <xsl:param>toc.max.depth=4 + # How far down we go with TOC's + <xsl:param>generate.section.toc.level=10 + # Index on type: + <xsl:param>index.on.type=1 + + # PDF Options: + # TOC Generation: this is needed for FOP-0.9 and later: + <xsl:param>fop1.extensions=0 + <format>pdf:<xsl:param>xep.extensions=1 + # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9! + <format>pdf:<xsl:param>fop.extensions=0 + # No indent on body text: + <format>pdf:<xsl:param>body.start.indent=0pt + # Margin size: + <format>pdf:<xsl:param>page.margin.inner=0.5in + # Margin size: + <format>pdf:<xsl:param>page.margin.outer=0.5in + # Paper type = A4 + <format>pdf:<xsl:param>paper.type=A4 + # Yes, we want graphics for admonishments: + <xsl:param>admon.graphics=1 + # Set this one for PDF generation *only*: + # default pnd graphics are awful in PDF form, + # better use SVG's instead: + <format>pdf:<xsl:param>admon.graphics.extension=".svg" + <format>pdf:<xsl:param>use.role.for.mediaobject=1 + <format>pdf:<xsl:param>preferred.mediaobject.role=print + <format>pdf:<xsl:param>img.src.path=$(images_location)/ + <format>pdf:<xsl:param>admon.graphics.path=$(images_location)/images/ + <format>pdf:<xsl:param>draft.mode="no" + # Choose indexing method (separately for html and pdf): + <format>html:<auto-index-internal>on # on (or off) to use internally generated indexes. + + <format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes. + : + # Default build options, can be overridden on the command line. + <auto-index>on # Turns on index (or off). + # Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders). + <auto-index-verbose>on + + <xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes. + # PDF native index support is probably better for PDFs as then you actually get page numbers. + + <auto-index-script>autoindex.idx # Specifies the name of the script to load for mylibrary. + ; + +install pdf-install : standalone : <install-type>PDF <location>. <name>auto_index.pdf ; + + + diff --git a/tools/auto_index/doc/auto_index.qbk b/tools/auto_index/doc/auto_index.qbk new file mode 100644 index 0000000000..17e5fb89e7 --- /dev/null +++ b/tools/auto_index/doc/auto_index.qbk @@ -0,0 +1,1149 @@ +[article Boost.AutoIndex + [quickbook 1.5] + [copyright 2008, 2011 John Maddock] + [license + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + [@http://www.boost.org/LICENSE_1_0.txt]) + ] + [authors [Maddock, John]] + [/last-revision $Date: 2008-11-04 17:11:53 +0000 (Tue, 04 Nov 2008) $] +] + +[def __quickbook [@http://www.boost.org/doc/tools/quickbook/index.html Quickbook]] +[def __boostbook [@http://www.boost.org/doc/html/boostbook.html BoostBook]] +[def __boostbook_docs [@http://www.boost.org/doc/libs/1_41_0/doc/html/boostbook.html BoostBook documentation]] +[def __quickbook_syntax [@http://www.boost.org/doc/libs/1_41_0/doc/html/quickbook/ref.html Quickbook Syntax Compendium]] +[def __docbook [@http://www.docbook.org/ DocBook]] +[def __docbook_params [@http://docbook.sourceforge.net/release/xsl/current/doc/ Docbook xsl:param format options]] +[def __DocObjMod [@http://en.wikipedia.org/wiki/Document_Object_Model Document Object Model (DOM)]] + +[def __doxygen [@http://www.doxygen.org/ Doxygen]] +[def __pdf [@http://www.adobe.com/products/acrobat/adobepdf.html PDF]] + +[template deg[]'''°'''] [/ degree sign ] + + +[section:overview Overview] + +AutoIndex is a tool for taking the grunt work out of indexing a +Boostbook\/Docbook document +(perhaps generated by your Quickbook file mylibrary.qbk, +and perhaps using also Doxygen autodoc) +that describes C\/C++ code. + +Traditionally, in order to index a Docbook document you would +have to manually add a large amount of `<indexterm>` markup: +in fact one `<indexterm>` for each occurrence of each term to be +indexed. + +Instead AutoIndex will automatically scan one or more C\/C++ header files +and extract all the ['function], ['class], ['macro] and ['typedef] +names that are defined by those headers, and then insert the +`<indexterm>`s into the Docbook XML document for you. + +AutoIndex can also scan using a list of index terms +specified in a script file, for example index.idx. +These manually provided terms can optionally be regular expressions, +and may allow the user to find references to terms +that may not occur in the C++ header files. Of course providing a manual +list of search terms in to index is a tedious task +(especially handling plurals and variants), +and requires enough knowledge of the library + to guess what users may be seeking to know, +but at least the real 'grunt work' of +finding the term and listing the page number is automated. + +AutoIndex creates index entries as follows: + +for each occurrence of each search term, it creates two index entries: + +# The search term as the ['primary index key] and + the ['title of the section it appears in] as a subterm. + +# The section title as the main index entry and the search term as the subentry. + +Thus the user has two chances to find what they're +looking for, based upon either the section name +or the ['function], ['class], ['macro] or ['typedef] name. + +[note This behaviour can be changed so that only one index entry is created + (using the search term as the key and + not using the section name except as a sub-entry of the search term).] + +So for example in Boost.Math the class name `students_t_distribution` has a primary +entry that lists all sections the class name appears in: + +[$../students_t_eg_1.png] + +Then those sections also have primary entries, which list all the search terms those +sections contain: + +[$../students_t_eg_2.png] + +Of course these automated index entries may not be quite +what you're looking for: often you'll get a few spurious entries, a few missing entries, +and a few entries where the section name used as an index entry is less than ideal. +So AutoIndex provides some powerful regular expression based rules that allow you +to add, remove, constrain, or rewrite entries. Normally just a few lines in +AutoIndex's script file are enough to tailor the output to match the author's +expectations (and thus hopefully the index user's expectations too!). + +AutoIndex also supports multiple indexes (as does Docbook), and since it knows +which search terms are ['function], ['class], ['macro] or ['typedef] names, it +can add the necessary attributes to the XML so that you can have separate +indexes for each of these different types. These specialised indexes only contain +entries for the ['function], ['class], ['macro] or ['typedef] names, ['section +names] are never used as primary index terms here, unlike the main "include everything" +index. + +Finally, while the Docbook XSL stylesheets create nice indexes complete with page +numbers for PDF output, the HTML indexes look poorer by comparison, as these use +section titles in place of page numbers... but as AutoIndex uses section titles +as index entries this leads to a lot of repetition, so as an alternative AutoIndex +can be instructed to construct the index itself. This is faster than using +the XSL stylesheets, and now each index entry is a hyperlink to the +appropriate section: + +[$../students_t_eg_3.png] + +With internal index generation there is also a helpful navigation bar +at the start of each Index: + +[$../students_t_eg_4.png] + +Finally, you can choose what kind of XML container wraps an internally generated index - +this defaults to `<section>...</section>` but you can use either command line options +or Boost.Build Jamfile features, to select an alternative wrapper - for example ['appendix] +or ['chapter] would be good choices, whatever fits best into the flow of the +document. You can even set the container wrapper to type ['index] provided you turn +off index generation by the XSL stylesheets, for example by setting the following +build requirements in the Jamfile: + +[pre +<format>html:<auto-index-internal>on # Use internally generated indexes. +<auto-index-type>index # Use <index>...</index> as the XML wrapper. +<format>html:<xsl:param>generate.index=0 # Don't let the XSL stylesheets generate indexes. +] + +[endsect] [/section:overview Overview] + +[section:tut Getting Started and Tutorial] + +[section:build Step 1: Build the AutoIndex tool] + +[note This step is strictly optional, but very desirable to speed up build times.] + +cd into `tools/auto_index/build` and invoke bjam as: + + bjam release + +Optionally pass the name of the compiler toolset you want to use to bjam as well: + + bjam release gcc + +This will build the tool and place a copy in the current directory (which is to say `tools/auto_index/build`) + +Now open up your `user-config.jam` file and at the end of the file add the line: + +[pre +using auto-index : ['full-path-to-boost-tree]/tools/auto_index/build/auto-index.exe ; +] + +[note +This declaration must go towards the end of `user-config.jam`, or in any case after the Boostbook initialisation. + +Also note that Windows users must use forward slashes in the paths in `user-config.jam`] + +[endsect] [/section:build Step 1: Build the AutoIndex tool] + +[section:configure Step 2: Configure Boost.Build jamfile to use AutoIndex] + +Assuming you have a Jamfile for building your documentation that looks +something like: + +[pre +boostbook standalone + : + mylibrary + : + # build requirements go here: + ; +] + +Then add the line: + +[pre using auto-index ; ] + +to the start of the Jamfile, and then add whatever auto-index options +you want to the ['build requirements section], for example: + +[pre + boostbook standalone + : + mylibrary + : + # Build requirements go here: + + # <auto-index>on (or off) one turns on (or off) indexing: + <auto-index>on + + # Turns on (or off) auto-index-verbose for diagnostic info. + # This is highly recommended until you have got all the many details correct! + <auto-index-verbose>on + + # Choose the indexing method (separately for html and PDF) - see manual. + # Choose indexing method for PDFs: + <format>pdf:<auto-index-internal>off + + # Choose indexing method for html: + <format>html:<auto-index-internal>on + + # Set the name of the script file to use (index.idx is popular): + <auto-index-script>index.idx + # Commands in the script file should all use RELATIVE PATHS + # otherwise the script will not be portable to other machines. + # Relative paths are normally taken as relative to the location + # of the script file, but we can add a prefix to all + # those relative paths using the <auto-index-prefix> feature. + # The path specified by <auto-index-prefix> may be either relative or + # absolute, for example the following will get us up to the boost root + # directory for most Boost libraries: + <auto-index-prefix>..\/..\/.. + + # Tell Quickbook that it should enable indexing. + <quickbook-define>enable_index ; + + ; +] [/pre] + +[section:options Available Indexing Options] + +The available options are: + +[variablelist +[[<auto-index>off/on][Turns indexing of the document on, defaults to +"off", so be sure to set this if you want AutoIndex invoked!]] +[[<auto-index-internal>off/on][Chooses whether AutoIndex creates the index +itself (feature on), or whether it simply inserts the necessary DocBook +markup so that the DocBook XSL stylesheets can create the index. Defaults to "off".]] +[[<auto-index-script>filename][Specifies the name of the script to load.]] +[[<auto-index-no-duplicates>off/on][When ['on] AutoIndex will only index a term +once in any given section, otherwise (the default) multiple index entries per +term may be created if the term occurs more than once in the section.]] +[[<auto-index-section-names>off/on][When ['on] AutoIndex will use create two +index entries for each term found - one uses the term itself as the primary +index key, the other uses the enclosing section name. When off the index +entry that uses the section title is not created. Defaults to "on"]] +[[<auto-index-verbose>off/on][Defaults to "off". When turned on AutoIndex +prints progress information - useful for debugging purposes during setup.]] +[[<auto-index-prefix>filename][Optionally specifies a directory to apply +as a prefix to all relative file paths in the script file. + +You may wish to do this to reduce typing of pathnames, and\/or where the +paths can't be located relative to the script file location, +typically if the headers are in the Boost trunk, +but the script file is in Boost sandbox. + +For Boost standard library layout, +[^<auto-index-prefix>..\/..\/..] will get you back up to the 'root' of the Boost tree, +so [^!scan-path boost\/mylibrary\/] is where your headers will be, and [^libs\/mylibrary] for other files. +Without a prefix all relative paths are relative to the location of the script file. +]] + +[[<auto-index-type>element-name][Specifies the name of the XML element in which to enclose an internally generated indexes: + defaults to ['section], but could equally be ['appendix] or ['chapter] or some other block level element that has a formal title. + The actual list of available options depends upon the Quickbook document type, the following table gives the available options, + assuming that the index is placed at the top level, and not in some sub-section or other container:]] +] + +[table +[[Document Type][Permitted Index Types]] +[[book][appendix index article chapter reference part]] +[[article][section appendix index sect1]] +[[chapter][section index sect1]] +[[library][The same as Chapter (section index sect1)]] +[[part][appendix index article chapter reference]] +[[appendix][section index sect1]] +[[preface][section index sect1]] +[[qandadiv][N/A: an index would have to be placed within a subsection of the document.]] +[[qandaset][N/A: an index would have to be placed within a subsection of the document.]] +[[reference][N/A: an index would have to be placed within a subsection of the document.]] +[[set][N/A: an index would have to be placed within a subsection of the document.]] +] + +In large part then the choice of `<auto-index-type>element-name` depends on the +formatting you want to be applied to the index: + +[table +[[XML Container Used for the Index][Formatting Applied by the XSL Stylesheets]] +[[appendix][Starts a new page.]] +[[article][Starts a new page.]] +[[chapter][Starts a new page.]] +[[index][Starts a new page only if it's contained within an article or book.]] +[[part][Starts a new page.]] +[[reference][Starts a new page.]] +[[sect1][Starts a new page as long as it's not the first section (but is controlled by the XSL parameters chunk.section.depth and/or chunk.first.sections).]] +[[section][Starts a new page as long as it's not the first section or nested within another section (but is controlled by the XSL parameters chunk.section.depth and/or chunk.first.sections).]] +] + +In almost all cases the default (section) is the correct choice - the exception is when the index is to be placed +directly inside a /book/ or /part/, in which case you should probably use the same XML container for the index as +you use for whatever subdivisions are in the /book/ or /part/. In any event placing a /section/ within a /book/ or +/part/ will result in invalid XML. + +Finally, if you are using Quickbook to generate the documentation, then you may wish to add: + +[pre <include>$boost-root/tools/auto_index/include] + +to your projects requirements (replacing $boost-root with the path to the root of the Boost tree), so that +the file auto_index_helpers.qbk can be included in your quickbook source with simply a: + +[pre \[include auto_index_helpers.qbk\]] + +[endsect] [/section:options Available Indexing Options] + +[section:optional Making AutoIndex optional] + +It is considerate to make the [*use of auto-index optional] in Boost.Build, +to allow users who do not have AutoIndex installed to still be able to build your documentation. + +This also very convenient while you are refining your documentation, +to allow you to decide to build indexes, or not: +building indexes can take long time, if you are just correcting typos, +you won't want to wait while you keep rebuilding the index! + +One method of setting up optional AutoIndex support is to place all +AutoIndex configuration in a the body of a bjam if statement: + +[pre + if --enable-index in \[ modules.peek : ARGV \] + { + ECHO "Building the docs with automatic index generation enabled." ; + + using auto-index ; + project : requirements + <auto-index>on + <auto-index-script>index.idx + + ... other AutoIndex options here... + + # And tell Quickbook that it should enable indexing. + <quickbook-define>enable_index + ; + } + else + { + ECHO "Building the my_library docs with automatic index generation disabled. To get an Index, try building with --enable-index." ; + } +] [/pre] + +You will also need to add a conditional statement at the end of your Quickbook file, +so that the index(es) is/are only added after the last section if indexing is enabled. + +[pre +\[\? '''enable_index''' +\'\'\' + <index/> +\'\'\' +\] +] [/pre] + + +To use this jamfile, you need to cd to your docs folder, for example: + + cd \boost-sandbox\guild\mylibrary\libs\mylibrary\doc + +and then run `bjam` to build the docs without index, for example: + + bjam -a html > mylibrary_html.log + +or with index(es) + + bjam -a html --enable-index > mylibrary_html_index.log + +[endsect] [/section:optional Making AutoIndex optional] + +[tip Always send the output to a log file. +It will contain of lot of stuff, but is invaluable to check if all has gone right, +or else diagnose what has gone wrong. +] [/tip] + +[tip A return code of 0 is not a reliable indication +that you have got what you really want - +inspecting the log file is the only certain way. +] [/tip] + +[tip If you upgrade compiler version, for example MSVC from 9 to 10, +then you may need to rebuild Autoindex +to avoid what Microsoft call a 'side-by-side' error. +And make sure that the autoindex.exe version you are using is the new one. +] [/tip] + +[endsect] [/section:configure Step 2: Configure Boost.Build to use AutoIndex] + +[section:add_indexes Step 3: Add indexes to your documentation] + +To add a single "include everything" index to a BoostBook\/Docbook document, +(perhaps generated using Quickbook, and perhaps also using Doxygen reference section), +add `<index/>` at the location where you want the index to appear. +The index will be rendered as a separate section called "Index" +when the documentation is built. + +To add multiple indexes, then give each one a title and set its +`type` attribute to specify which terms will be included, for example +to place the ['function], ['class], ['macro] or ['typedef] names +indexed by ['AutoIndex] in separate indexes along with a main +"include everything" index as well, one could add: + +[pre +<index type\="class_name"> +<title>Class Index<\/title> +<\/index> + +<index type\="typedef_name"> +<title>Typedef Index<\/title> +<\/index> + +<index type\="function_name"> +<title>Function Index<\/title> +<\/index> + +<index type\="macro_name"> +<title>Macro Index<\/title> +<\/index> + +<index\/> +] + +[note Multiple indexes like this only work correctly if you tell the XSL stylesheets +to honor the "type" attribute on each index as by default [/[*they do not do this]]. +You can turn the feature on by adding `<xsl:param>index.on.type=1` to your projects +requirements in the Jamfile.] + +In Quickbook, you add the same markup but enclose it between two triple-tick \'\'\' escapes, +thus + +[pre \'\'\'<index\/>\'\'\' ] + +Or more easily via the helper file auto_index_helpers.qbk, so that given: + +[pre \[include auto_index_helpers.qbk\]] + +one can simply write: + +[pre +\[named_index class_name Class Index\] +\[named_index function_name Function Index\] +\[named_index typedef_name Typedef Index\] +\[named_index macro_name Macro Index\] +\[index\] +] + +[note AutoIndex knows nothing of the XML `xinclude` element, so if +you're writing raw Docbook XML then you may want to run this through an +XSL processor to flatten everything to one XML file before passing to +AutoIndex. If you're using Boostbook or quickbook though, this all +happens for you anyway, and AutoIndex will index the whole document +including any sections included with `xinclude`.] + +If you are using AutoIndex's internal index generation on + +[pre +<auto-index-internal>on +] +(usually recommended for HTML output, but ['not] the default) +then you can also decide what kind of XML wrapper the generated index is placed in. +By default this is a `<section>...</section>` XML block (this replaces the original +`<index>...</index>` block). However, depending upon the structure of the document +and whether or not you want the index on a separate page - or else on the front page after +the TOC - you may want to place the index inside a different type of XML block. For example +if your document uses `<chapter>` top level content rather than `<section>`s then +it may be preferable to place the index in a `<chapter>` or `<appendix>` block. +You can also place the index inside an `<index>` block if you prefer, in which case the index +does not appear in on a page of its own, but after the TOC in the HTML output. + +You control the type of XML block used by setting the =<auto-index-type>element-name= +attribute in the Jamfile, or via the `index-type=element-name` command line option to +AutoIndex itself. For example, to place the index in an appendix, your Jamfile might +look like: + +[pre +using quickbook ; +using auto-index ; + +xml mylibrary : mylibary.qbk ; +boostbook standalone + : + mylibrary + : + # auto-indexing is on: + <auto-index>on + + # PDFs rely on the XSL stylesheets to generate the index: + <format>pdf:<auto-index-internal>off + + # HTML output uses auto-index to generate the index: + <format>html:<auto-index-internal>on + + # Name of script file to use: + <auto-index-script>index.idx + + # Set the XML wrapper for HML Indexes to "appendix": + <format>html:<auto-index-type>appendix + + # Turn on multiple index support: + <xsl:param>index.on.type=1 +] + + +[endsect] [/section:add_indexes Step 3: Add indexes to your documentation] + +[section:script Step 4: Create the .idx script file - to control what to terms to index] + +AutoIndex works by reading a script file that tells it what terms to index. + +If your document contains largely text, and only a small amount of simple C++, +and/or if you are using Doxygen to provide a C++ Reference section +(that lists the C++ elements), +and/or if you are relying on the indexing provided from a Standalone Doxygen Index, +you may decide that a index is not needed +and that you may only want the text part indexed. + +But if you want C++ classes functions, typedefs and/or macros AutoIndexed, +optionally, the script file also tells which other C++ files to scan. + +At its simplest, it will scan one or more headers for terms that +should be indexed in the documentation. So for example to scan +"myheader.hpp" the script file would just contain: + + !scan myheader.hpp + !scan mydetailsheader.hpp + +Or, more likely in practice, so +we can recursively scan through directories looking for all +the files to scan whose [*name matches a particular regular expression]: + +[pre !scan-path "boost\/mylibrary" ".*\.hpp" true ] + +Each argument is whitespace separated and can be optionally +enclosed in "double quotes" (recommended). + +The final ['true] argument indicates +that subdirectories in `/boost/math/mylibrary` should be searched +recursively in addition to that directory. + +[caution The second ['file-name-regex] argument is a regular expression and not a filename GLOB!] + +[caution The scan-path is modified by any setting of <auto-index-prefix>. +The examples here assume that this is [^<auto-index-prefix>..\/..\/..] +so that `boost/mylibrary` will be your header files, +`libs/mylibrary/doc` will contain your documentation files and +`libs/mylibrary/example` will contain your examples. +] + +You could also scan any examples (.cpp) files, +typically in folder `/mylibrary/lib/example`. + +[pre +# All example source files, assuming no sub-folders. +!scan-path "libs\/mylibrary\/example" ".*\\.cpp" +] [/pre] + +Often the ['scan] or ['scan-path] rules will bring in too many terms +to search for, so we need to be able to exclude terms as well: + + !exclude type + +Which excludes the term "type" from being indexed. + +We can also add terms manually: + + foobar + +will index occurrences of "foobar" and: + + foobar \<\w*(foo|bar)\w*\> + +will index any whole word containing either "foo" or "bar" within it, +this is useful when you want to index a lot of similar or related +words under one entry, for example: + + reflex + +Will only index occurrences of "reflex" as a whole word, but: + + reflex \<reflex\w*\> + +will index occurrences of "reflex", "reflexing" and +"reflexed" all under the same entry ['reflex]. +You will very often need to use this to deal with plurals and other variants. + +This inclusion rule can also restrict the term to +certain sections, and add an index category that +the term should belong to (so it only appears in certain +indexes). + +Finally the script can add rewrite rules, that rename section names +that are automatically used as index entries. For example we might +want to remove leading "A" or "The" prefixes from section titles +when AutoIndex uses them as an index entry: + + !rewrite-name "(?i)(?:A|The)\s+(.*)" "\1" + +[endsect] [/section:script Step 4: Create the script file - to control what to terms to index] + +[section:entries Step 5: Add Manual Index Entries to Docbook XML - Optional] + +If you add manual `<indexentry>` markup to your Docbook XML then these will be +passed through unchanged. Please note however, that if you are using +AutoIndex's internal index generation then it only recognises +`<primary>`, `<secondary>` and `<tertiary>` elements within the `<indexterm>`. +`<see>` and `<seealso>` elements are not currently recognised +and AutoIndex will emit a warning if these are used. + +Likewise none of the attributes which can be applied to these elements are used when +AutoIndex generates the index itself, with the exception of the `<type>` attribute. + +For Quickbook users, there are some templates in auto_index_helpers.qbk that assist +in adding manual entries without having to escape to Docbook. + +[endsect] [/section:entries Step 5: Add Manual Index Entries to Docbook XML - Optional] + +[section:pis Step 6: Using XML processing instructions to control what gets indexed.] + +Sometimes when you need to exclude certain sections of text from indexing, +then you can achieve this with the following XML processing instructions: + +[table +[[Instruction][Effect]] +[[`<?BoostAutoIndex IgnoreSection?>`] + [Causes the whole of the current section to be excluded from indexing. + By "section" we mean either a true "section" or any sibling XML element: + "dedication", "toc", "lot", "glossary", "bibliography", "preface", "chapter", + "reference", "part", "article", "appendix", "index", "setindex", "colophon", + "sect1", "refentry", "simplesect", "section" or "partintro".]] +[[`<?BoostAutoIndex IgnoreBlock?>`] + [Causes the whole of the current text block to be excluded from indexing. + A text block may be any of the section/chapter elements listed above, or a + paragraph, code listing, table etc. The complete list is: + "calloutlist", "glosslist", "bibliolist", "itemizedlist", "orderedlist", + "segmentedlist", "simplelist", "variablelist", "caution", "important", "note", + "tip", "warning", "literallayout", "programlisting", "programlistingco", + "screen", "screenco", "screenshot", "synopsis", "cmdsynopsis", "funcsynopsis", + "classsynopsis", "fieldsynopsis", "constructorsynopsis", + "destructorsynopsis", "methodsynopsis", "formalpara", "para", "simpara", + "address", "blockquote", "graphic", "graphicco", "mediaobject", + "mediaobjectco", "informalequation", "informalexample", "informalfigure", + "informaltable", "equation", "example", "figure", "table", "msgset", "procedure", + "sidebar", "qandaset", "task", "productionset", "constraintdef", "anchor", + "bridgehead", "remark", "highlights", "abstract", "authorblurb" or "epigraph".]] +] + +For Quickbook users the file auto_index_helpers.qbk contains a helper template +that assists in inserting these processing instructions, for example: + +[pre \[AutoIndex IgnoreSection\]] + +Will cause that section to not be indexed. + +[endsect] [/section:pis Step 6: Using XML processing instructions to control what gets indexed.] + +[section:build_docs Step 7: Build the Docs] + +Using Boost.Build you build the docs with either: + + bjam release > mylibrary_html.log + +To build the html docs or: + + bjam pdf release > mylibrary_pdf.log + +To build the pdf. + +During the build process you should see AutoIndex emit a message in the log file +such as: + +[pre Indexing 990 terms... ] + +If you don't see that, or if it's indexing 0 terms then something is wrong! + +Likewise when index generation is complete, AutoIndex will emit another message: + +[pre 38 Index entries were created.] + +Again, if you see that 0 entries were created then something is wrong! + +Examine the log file, and if the cause is not obvious, +make sure that you have [^<auto-index-verbose>on] and that +any needed +[^!debug regular-expression] directives are in your script file. + +[endsect] [/section:build_docs Step 7: Build the Docs] + +[section:refine Step 8: Iterate - to refine your index] + +Creating a good index is an iterative process, often the first step is +just to add a header scanning rule to the script file and then generate +the documentation and see: + +* What's missing. +* What's been included that shouldn't be. +* What's been included under a poor name. + +Further rules can then be added to the script to handle these cases +and the next iteration examined, and so on. + +[tip If you don't understand why a particular term is (or is not) present in the index, +try adding a ['!debug regular-expression] +directive to the [link boost_autoindex.script_ref script file]. +] [/tip] + +[heading Restricting which Sections are indexed for a particular term] + +You can restrict which sections are indexed for a particular term. +So assuming that the docbook document has the usual hierarchical names for section ID's +(as Quickbook generates, for example), +you can easily place a constraint on which sections are examined for a particular term. + +For example, if you want to index occurrences of Lord Kelvin's name, +but only in the introduction section, you might then add: + + Kelvin "" ".*introduction.*" + +to the script file, +assuming that the section ID of the intro is "some_library_or_chapter_name.introduction". + +This would avoid an index entry every time 'Kelvin' is found, +something the user is unlikely to find helpful. + +[endsect] [/section:refine Step 8: Iterate - to refine your index] + +[endsect] [/section:tut Getting Started and Tutorial] + + +[section:script_ref Script File (.idx) Reference] + +The following elements can occur in a script: + +[h4 Comments and blank lines] + +Blank lines consisting of only whitespace are ignored, so are lines that [*start with a #]. + +[note You can't append \# comments onto the end of a line\!] + +[h4 Inclusion of Index terms] + + term [regular-expression1 [regular-expression2 [category]]] + +[variablelist +[[term][ +['Term to index.] + +The index term will form a primary entry in the Index +with the section title(s) containing the term as secondary entries, and +also will be used as a secondary entry beneath each of the section +titles that the index term occurs in.] +] [/term] + +[[regular-expression1][ +['Index term Searcher.] + +An optional regular expression: each occurrence +of the regular expression in the text of the document will result +in one index term being emitted. + +If the regular expression is omitted (default) or is "", then the ['index term] itself +will be used as the search text - and only occurrence of whole words matching +['index term] will be indexed. + +For example: + +``foobar`` + +will index occurrences of "foobar" in any section, but + +``foobar \<\w*(foo|bar)\w*\>`` + +will index any whole word containing either "foo" or "bar" within it. +This is useful when you want to index a lot of similar or related words under one entry. + +``reflex`` + +will only index occurrences of "reflex" as a whole word, but: + +``reflex \<reflex\w*\>`` + +will index occurrences of "reflex", "reflexes", "reflexing" and "reflexed" ... +all under the same entry reflex. + +You will very often need to use this to deal with plurals and other variants.] +] [/regular-expression1] + +[[regular-expression2] +[['Section(s) Selector.] + +A constraint that specifies which sections are +indexed for ['term]: only if the ID of the section matches +['regular-expression2] exactly will that section be indexed +for occurrences of ['term]. + +For example, to limit indexing to just [*one specific section] (but not sub-sections below): + +``myclass "" "mylib\.examples"`` + + +For example, to limit indexing to specific sections, [*and sub-sections below]: + +``myclass "" "mylib\.examples.*"`` + +will index occurrences of "myclass" as a whole word, +but only in sections whose section ID [*begins] "mylib.examples", while + +``myclass "\<myclass\w*\>" "mylib\.examples.*"`` + +will also index plurals myclass, myclasses, myclasss ... + +and: + +``myclass "" "(?!mylib\.introduction).*"`` + +will index occurrences of "myclass" in any section, +except those whose section IDs begin "mylib.introduction". + +Finally, two (or more) sections can be excluded by OR'ing them together: + +``myclass "" "(?!mylib\.introduction|mylib\.reference).*"`` + +which excludes searching for this term in sections whose ID's start with either "mylib.introduction" or "mylib.reference". + +If this third section selection field is omitted (the default) +or is "", then [*all sections] are indexed for this term. +] +] [/regular-expression2] + +[[category][ +['Index Category Constraint.] + +Optionally a category to place occurrences of ['index term] in. +If you have multiple indexes then this is the name +assigned to the indexes "type" attribute. + +For example: + + myclass "" "" class_name + +Will index occurances of ['myclass] and place them in the class-index if there is one. + +]] [/category] + +] [/variablelist] + +You can have an index term appear more than once in the script file: + +* If they have different /category/ names then they are treated quite separately. +* Otherwise they are combined, so that the logical or of the regular expressions provided are taken. + +Thus: + + myterm search_expression1 constrait_expression2 foo + myterm search_expression1 constrait_expression2 bar + +Will be treated as different terms each with their own entries, while: + + myterm search_expression1 constrait_expression2 mycategory + myterm search_expression1 constrait_expression2 mycategory + +Will be combined into a single term equivalent to: + + myterm (?:search_expression1|search_expression1) (?:constrait_expression2|constrait_expression2) mycategory + +[h4 Source File Scanning] + + !scan source-file-name + +Scans the C\/C++ source file ['source-file-name] for definitions of +['function]s, ['class]s, ['macro]s or ['typedef]s and makes each of +these a term to be indexed. Terms found are assigned to the index category +"function_name", "class_name", "macro_name" or "typedef_name" depending +on how they were seen in the source file. These may then be included +in a specialised index whose "type" attribute has the same category name. + +[important +When actually indexing a document, the scanner will not index just any old occurrence of the +terms found in the source files. Instead it searches for class definitions or function or +typedef declarations. This reduces the number of spurious matches placed in the index, but +may also miss some legitimate terms: +refer to the /define-scanner/ command for information on how to change this. +] + +[h4 Directory and Source File Scanning] + + !scan-path directory-name file-name-regex [recurse] + +[variablelist +[[directory-name][The directory to scan: this should be a path relative +to the script file (or to the path specified with the prefix=path option on the command line) +and should use all forward slashes in its file name.]] + +[[file-name-regex][A regular expression: any file in the directory whose name +matches the regular expression will be scanned for terms to index.]] + +[[recurse][An optional boolean value - either "true" or "false" - that +indicates whether to recurse into subdirectories. This defaults to "false".]] +] + +[h4 Excluding Terms] + + !exclude term-list + +Excludes all the terms in whitespace separated ['term-list] from being indexed. +This should be placed /after/ any ['!scan] or ['!scan-path] rules which may +result in the terms becoming included. In other words this removes terms from +the scanners internal list of things to index. + +[h4 Rewriting Section Names] + +[pre !rewrite-id regular-expression new-name] + +[variablelist +[[regular-expression][A regular expression: all section ID's that match +the expression exactly will have index entries ['new-name] instead of +their title(s).]] + +[[new-name][The name that the section will appear under in the index.]] +] + + !rewrite-name regular-expression format-text + +[variablelist +[[regular-expression][A regular expression: all sections whose titles +match the regular expression exactly, will have index entries composed +of the regular expression match combined with the regex format string +['format-text].]] +[[format-text][The Perl-style format string used to reformat the title.]] +] + +For example: + +[pre +!rewrite-name "(?:A|An|The)\s+(.*)" "\1" +] + +Will remove any leading "A", "An" or "The" from all index entries - thus preventing lots of +entries under "The" etc! + +[h4 Defining or Changing the File Scanners] + + !define-scanner type file-search-expression xml-regex-formatter term-formatter id-filter filename-filter + +When a source file is scanned using the =!scan= or =!scan-path= rules, then the file is searched using +a series of regular expressions to look for classes, functions, macros or typedefs that should be indexed. +A set of default regular expressions are provided for this (see below), but sometimes you may want to replace +the defaults, or add new scanners. The arguments to this rule are: + +[variablelist +[[type][The ['type] to which items found using this rule will assigned, index terms created from the +source file and then found in the XML, will have the type attribute set to this value, and may then appear in a +specialized index with the same type attribute]] +[[file-search-expression][A regular expression that is used to scan the source file for index terms, the result of +a match against this expression will be transformed by the next two arguments.]] +[[xml-regex-formatter][A regular expression format string that extracts the salient information from whatever +matched the ['file-search-expression] in the source file, and creates ['a new regular expression] that will +be used to search the document being indexed for occurrences of this index term.]] +[[term-formatter][A regular expression format string that extracts the salient information from whatever +matched the ['file-search-expression] in the source file, and creates the index term that will appear in +the index.]] +[[id-filter][Optional. A regular expression that restricts the section-id's that are searched in the document being indexed: +only sections whose ID attribute matches this expression exactly will be considered for indexing terms found by this scanner.]] +[[filename-filter][Optional. A regular expression that restricts which files are scanned by this scanner: only files whose file name +matches this expression exactly will be scanned for index terms to use. Note that the filename matched against this may +well be an absolute path, and contain either forward or backward slash path separators.]] +] + +If, when the first file is scanned, there are no scanners whose ['type] is "class_name", "typedef_name", "macro_name" or +"function_name", then the defaults are installed. These are equivalent to: + + !define-scanner class_name "^[[:space:]]*(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\<\w+\>([[:blank:]]*\([^)]*\))?[[:space:]]*)*(\<\w*\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\{|:[^;\{()]*\{)" "(?:class|struct)[^;{]+\\<\5\\>[^;{]+\\{" \5 + !define-scanner typedef_name "typedef[^;{}#]+?(\w+)\s*;" "typedef[^;]+\\<\1\\>\\s*;" "\1" + !define-scanner "macro_name" "^\s*#\s*define\s+(\w+)" "\\<\1\\>" "\1" + !define-scanner "function_name" "\w+(?:\s*<[^>]>)?[\s&*]+?(\w+)\s*(?:BOOST_[[:upper:]_]+\s*)?\([^\)]*\)\s*[;{]" "\\<\\w+\\>(?:\\s+<[^>]*>)?[\\s&*]+\\<\1\\>\\s*\\([^;{]*\\)" "\1" + +Note that these defaults are not installed if you have provided your own versions with these ['type] names. In this case if +you want the default scanners to be in effect as well as your own, you should include the above in your script file. +It is also perfectly allowable to have multiple scanners with the same ['type], but with the other fields differing. + +Finally you should note that the default scanners are quite strict +in what they will find, for example the class +scanner will only create index entries for classes that have class definitions of the form: + + class my_class : public base_classes + { + // etc + +In the documentation, so that simple mentions of the class name will ['not] get indexed, +only the class synopsis if there is one. +If this isn't how you want things, then include the ['class_name] scanner definition +above in your script file, and change +the ['xml-regex-formatter] field to something more permissive, for example: + + !define-scanner class_name "^[[:space:]]*(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\<\w+\>([[:blank:]]*\([^)]*\))?[[:space:]]*)*(\<\w*\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\{|:[^;\{()]*\{)" "\\<\5\\>" \5 + +Will look for ['any] occurrence of whatever class names the scanner may find in the documentation. + +[h4 Debugging scanning] + +If you see a term in the index, and you don't understand why it's there, add a ['debug] directive: + +[pre +!debug regular-expression +] + +Now, whenever ['regular-expression] matches either the found index term, +or the section title it appears in, or the ['type] field of a scanner, then +some diagnostic information will be printed that will look something like: + +[pre +Debug term found, in block with ID: spirit.qi.reference.parser_concepts.parser +Current section title is: Notation +The main index entry will be : Notation +The indexed term is: parser +The search regex is: \[P\|p\]arser +The section constraint is: .*qi.reference.parser_concepts.* +The index type for this entry is: qi_index +] + +This can produce a lot of output in your log file, +but until you are satisfied with your file selection and scanning process, +it is worth switching it on. + +[endsect] [/section:script_ref Script File Reference] + +[section:workflow Understanding The AutoIndex Workflow] + +# Load the script file (usually index.idx) + and process it one line at a time, + producing one or more index term per (non-comment) line. + +# Reading all lines builds a list of ['terms to index]. + Some of those may be terms defined (by you) directly in the script file, + others may be terms found by scanning C++ header and source files + that were specified by the ['!scan-path] directive. + +# Once the complete list of ['terms to index] is complete, + it loads the Docbook XML file. + (If this comes from Quickbook\/Doxygen\/Boostbook\/Docbook then this is + the complete documentation after conversion to Docbook format). + +# AutoIndex builds an internal __DocObjMod of the Docbook XML. + This internal representation then gets scanned for occurrences of the ['terms to index]. + This scanning works at the XML paragraph level + (or equivalent sibling such as a table or code block) + - so all the XML encoding within a paragraph gets flattened to plain text.[br] + This flattening means the regular expressions used to search for ['terms to index] + can find anything that is completely contained within a paragraph + (or code block etc). + +# For each term found then an ['indexterm] Docbook element is inserted + into the __DocObjMod (provided internal index generation is off), + +# Also the AutoIndex's internal index representation gets updated. + +# Once the whole XML document has been indexed, + then, if AutoIndex has been instructed to generate the index itself, + it creates the necessary XML and inserts this into the __DocObjMod. + +# Finally the whole __DocObjMod is written out as a new Docbook XML file, + and normal processing of this continues via the XSL stylesheets (with xsltproc) + to actually build the final human-readable docs. + +[endsect] [/section:workflow AutoIndex Workflow] + + +[section:xml XML Handling] + +AutoIndex is rather simplistic in its handling of XML: + +* When indexing a document, all block content at the paragraph level gets collapsed into a single +string for matching against the regular expressions representing each index term. In other words, +for the most part, you can assume that you're indexing plain text when writing regular expressions. +* Named XML entities for &, ", ', < or > are converted to their corresponding characters before indexing +a section of text. However, decimal or hex escape sequences are not currently converted. +* Index terms are assumed to be plain text (whether they originate from the script file +or from scanning source files) and the characters &, ", < and > will be escaped to +& " < and > respectively. + +[endsect] [/section:xml XML Handling] + +[section:qbk Quickbook Support] + +The file auto_index_helpers.qbk in ['boost-path]/tools/auto_index/include contains various Quickbook +templates to assist with AutoIndex support. One would normally add the above path to your include +search path via an `<include>path` statement in your Jamfile, and then make the templates available +to your Quickbook source via a: + +[pre \[include auto_index_helpers.qbk\]] + +statement at the start of your Quickbook file. + +The available templates are then: + +[table +[[Template][Description]] +[[`[index]`][Creates a main index, with no "type" category set, which will be titled simply "Index".]] +[[`[named_index type title]`][Creates an index with the type attribute set to "type" and the title will be "title".[br] + For example to create an index containing only class names one would typically add `[named_index class_name Class Index]` + to your Quickbook source.]] +[[`[AutoIndex Arg]`][Creates a Docbook processing instruction that will be handled by AutoIndex, valid values for "Arg" + are either "IgnoreSection" or "IgnoreBlock".]] +[[`[indexterm1 primary-key]`][Creates a manual index entry that will link to the current section, and have a single primary key "primary-key". + Note that this index key will not have a "type" attribute set, and so will only appear in the main index.]] +[[`[indexterm2 primary-key secondary-key]`][Creates a manual index entry that will link to the current section, and has + "primary-key" and "secondary key" as the primary and secondary keys respectively. + Note that this index key will not have a "type" attribute set, and so will only appear in the main index.]] +[[`[indexterm3 primary-key secondary-key tertiary-key]`][Creates a manual index entry that will link to the current section, + and have primary, secondary and tertiary keys: "primary-key", "secondary key" and "tertiary key". + Note that this index key will not have a "type" attribute set, and so will only appear in the main index.]] + +[[`[typed_indexterm1 type primary-key]`][Creates a manual index entry that will link to the current section, and have a single primary key "primary-key". + Note that this index key will have the "type" attribute set to the "type" argument, and so may appear in named sub-indexes + that also have their type attribute set.]] +[[`[typed_indexterm2 type primary-key secondary-key]`][Creates a manual index entry that will link to the current section, and has + "primary-key" and "secondary key" as the primary and secondary keys respectively. + Note that this index key will have the "type" attribute set to the "type" argument, and so may appear in named sub-indexes + that also have their type attribute set.]] +[[`[typed_indexterm3 type primary-key secondary-key tertiary-key]`][Creates a manual index entry that will link to the current section, + and have primary, secondary and tertiary keys: "primary-key", "secondary key" and "tertiary key". + Note that this index key will have the "type" attribute set to the "type" argument, and so may appear in named sub-indexes + that also have their type attribute set.]] +] + +[endsect] + +[section:comm_ref Command Line Reference] + +The following command line options are supported by AutoIndex: + +[variablelist +[[--in=infilename][Specifies the name of the XML input file to be indexed.]] +[[--out=outfilename][Specifies the name of the new XML file to create.]] +[[--scan=source-filename][Specifies that ['source-filename] should be scanned +for terms to index.]] +[[--script=script-filename][Specifies the name of the script file to process.]] +[[--no-duplicates][If a term occurs more than once in the same section, then +include only one index entry.]] +[[--internal-index][Specifies that AutoIndex should generate the actual +indexes rather than inserting `<indexterm>`s and leaving index generation +to the XSL stylesheets.]] +[[--no-section-names][Prevents AutoIndex from using section names as index entries.]] +[[--prefix=pathname][Specifies a directory to apply as a prefix to all relative file paths in the script file.]] +[[--index-type=element-name][Specifies the name of the XML element to enclose internally generated indexes in: + defaults to ['section], but could equally be ['appendix] or ['chapter] + or some other block level element that has a formal title.]] +] + +[endsect] [/section:comm_ref Command Line Reference] + +[include ../include/auto_index_helpers.qbk] + +[index] diff --git a/tools/auto_index/doc/autoindex.idx b/tools/auto_index/doc/autoindex.idx new file mode 100644 index 0000000000..8747267215 --- /dev/null +++ b/tools/auto_index/doc/autoindex.idx @@ -0,0 +1,93 @@ +# autoindex.idx index script file +# for Boost.autoindex Quickbook Doxygen documentation Auto-indexing. + +# Copyright (c) 2011 Paul A. Bristow + +# Use, modification and distribution is subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# Diagnostic output - useful during refinement of the index. +# !debug your-choice-of-regular-expression-to-debug + +# Terms that you want to appear in the Index. +# Term to display in index, and word(s) that are to be matched (as a regular expression). + +# Diagnostic while testing. +#!debug regular-expression +# For example +#!debug \w*\<index\w*\> + +appendix +chapter +section + +AutoIndex +Quickbook +Boostbook +Docbook +Doxygen +Document Object Model "DOM" +XML +html +PDF +XSL + +MSVC +side-by-side +stylesheet \<stylesheet\w*\> + +"XSL stylesheet" \<(XSL|stylesheet)\w*\> + +bjam +jamfile +Boost.Build + +"log file" \<log\w*\> + +C++ + +macro +function +class +typedef + +# Plural, and plurals. +plural \<plural\w*\> + +# To allow plurals: +index \<index\w*\> + +# Allow hyperlink and hyperlinking: +hyperlink \<hyperlink\w*\> + +# Two word index term, allowing plurals. +"side effect" \<side effect\w*\> + +text \<text\w*\> + +page \<page\w*\> +appendix \<appendi\w*\> +section \<section\w*\> +chapter \<chapter\w*\> + +script + +verbose \<\w*verbose\w*\> +debug \<debug\w*\> + +index term "index term" + +!exclude junk +# Exclude the index term junk from the index, +# so that "junk" anywhere does not have an index entry. + +# Remove leading "A" or "The" prefixes from section titles. +!rewrite-name "(?i)(?:A|The)\s+(.*)" "\1" + +!rewrite-name "Additional Implementation Notes" "Implementation Notes" + + + + + diff --git a/tools/auto_index/doc/html/boost_autoindex/comm_ref.html b/tools/auto_index/doc/html/boost_autoindex/comm_ref.html new file mode 100644 index 0000000000..a032095b58 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/comm_ref.html @@ -0,0 +1,95 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Command Line Reference</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="qbk.html" title="Quickbook Support"> +<link rel="next" href="../index/s08.html" title="Index"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="qbk.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="../index/s08.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.comm_ref"></a><a class="link" href="comm_ref.html" title="Command Line Reference">Command Line Reference</a> +</h2></div></div></div> +<p> + The following command line options are supported by AutoIndex: + </p> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">--in=infilename</span></dt> +<dd><p> + Specifies the name of the XML input file to be indexed. + </p></dd> +<dt><span class="term">--out=outfilename</span></dt> +<dd><p> + Specifies the name of the new XML file to create. + </p></dd> +<dt><span class="term">--scan=source-filename</span></dt> +<dd><p> + Specifies that <span class="emphasis"><em>source-filename</em></span> should be scanned + for terms to index. + </p></dd> +<dt><span class="term">--script=script-filename</span></dt> +<dd><p> + Specifies the name of the script file to process. + </p></dd> +<dt><span class="term">--no-duplicates</span></dt> +<dd><p> + If a term occurs more than once in the same section, then include only + one index entry. + </p></dd> +<dt><span class="term">--internal-index</span></dt> +<dd><p> + Specifies that AutoIndex should generate the actual indexes rather than + inserting <code class="computeroutput"><span class="special"><</span><span class="identifier">indexterm</span><span class="special">></span></code>s and leaving index generation to + the XSL stylesheets. + </p></dd> +<dt><span class="term">--no-section-names</span></dt> +<dd><p> + Prevents AutoIndex from using section names as index entries. + </p></dd> +<dt><span class="term">--prefix=pathname</span></dt> +<dd><p> + Specifies a directory to apply as a prefix to all relative file paths + in the script file. + </p></dd> +<dt><span class="term">--index-type=element-name</span></dt> +<dd><p> + Specifies the name of the XML element to enclose internally generated + indexes in: defaults to <span class="emphasis"><em>section</em></span>, but could equally + be <span class="emphasis"><em>appendix</em></span> or <span class="emphasis"><em>chapter</em></span> or some + other block level element that has a formal title. + </p></dd> +</dl> +</div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="qbk.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="../index/s08.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/overview.html b/tools/auto_index/doc/html/boost_autoindex/overview.html new file mode 100644 index 0000000000..658ac7e236 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/overview.html @@ -0,0 +1,168 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Overview</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="../index.html" title="Boost.AutoIndex"> +<link rel="next" href="tut.html" title="Getting Started and Tutorial"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tut.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.overview"></a><a class="link" href="overview.html" title="Overview">Overview</a> +</h2></div></div></div> +<p> + AutoIndex is a tool for taking the grunt work out of indexing a Boostbook/Docbook + document (perhaps generated by your Quickbook file mylibrary.qbk, and perhaps + using also Doxygen autodoc) that describes C/C++ code. + </p> +<p> + Traditionally, in order to index a Docbook document you would have to manually + add a large amount of <code class="computeroutput"><span class="special"><</span><span class="identifier">indexterm</span><span class="special">></span></code> markup: in fact one <code class="computeroutput"><span class="special"><</span><span class="identifier">indexterm</span><span class="special">></span></code> + for each occurrence of each term to be indexed. + </p> +<p> + Instead AutoIndex will automatically scan one or more C/C++ header files and + extract all the <span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>class</em></span>, + <span class="emphasis"><em>macro</em></span> and <span class="emphasis"><em>typedef</em></span> names that are + defined by those headers, and then insert the <code class="computeroutput"><span class="special"><</span><span class="identifier">indexterm</span><span class="special">></span></code>s + into the Docbook XML document for you. + </p> +<p> + AutoIndex can also scan using a list of index terms specified in a script file, + for example index.idx. These manually provided terms can optionally be regular + expressions, and may allow the user to find references to terms that may not + occur in the C++ header files. Of course providing a manual list of search + terms in to index is a tedious task (especially handling plurals and variants), + and requires enough knowledge of the library to guess what users may be seeking + to know, but at least the real 'grunt work' of finding the term and listing + the page number is automated. + </p> +<p> + AutoIndex creates index entries as follows: + </p> +<p> + for each occurrence of each search term, it creates two index entries: + </p> +<div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + The search term as the <span class="emphasis"><em>primary index key</em></span> and the + <span class="emphasis"><em>title of the section it appears in</em></span> as a subterm. + </li> +<li class="listitem"> + The section title as the main index entry and the search term as the subentry. + </li> +</ol></div> +<p> + Thus the user has two chances to find what they're looking for, based upon + either the section name or the <span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>class</em></span>, + <span class="emphasis"><em>macro</em></span> or <span class="emphasis"><em>typedef</em></span> name. + </p> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"><p> + This behaviour can be changed so that only one index entry is created (using + the search term as the key and not using the section name except as a sub-entry + of the search term). + </p></td></tr> +</table></div> +<p> + So for example in Boost.Math the class name <code class="computeroutput"><span class="identifier">students_t_distribution</span></code> + has a primary entry that lists all sections the class name appears in: + </p> +<p> + <span class="inlinemediaobject"><img src="../../students_t_eg_1.png" alt="students_t_eg_1"></span> + </p> +<p> + Then those sections also have primary entries, which list all the search terms + those sections contain: + </p> +<p> + <span class="inlinemediaobject"><img src="../../students_t_eg_2.png" alt="students_t_eg_2"></span> + </p> +<p> + Of course these automated index entries may not be quite what you're looking + for: often you'll get a few spurious entries, a few missing entries, and a + few entries where the section name used as an index entry is less than ideal. + So AutoIndex provides some powerful regular expression based rules that allow + you to add, remove, constrain, or rewrite entries. Normally just a few lines + in AutoIndex's script file are enough to tailor the output to match the author's + expectations (and thus hopefully the index user's expectations too!). + </p> +<p> + AutoIndex also supports multiple indexes (as does Docbook), and since it knows + which search terms are <span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>class</em></span>, + <span class="emphasis"><em>macro</em></span> or <span class="emphasis"><em>typedef</em></span> names, it can add + the necessary attributes to the XML so that you can have separate indexes for + each of these different types. These specialised indexes only contain entries + for the <span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>class</em></span>, <span class="emphasis"><em>macro</em></span> + or <span class="emphasis"><em>typedef</em></span> names, <span class="emphasis"><em>section names</em></span> are + never used as primary index terms here, unlike the main "include everything" + index. + </p> +<p> + Finally, while the Docbook XSL stylesheets create nice indexes complete with + page numbers for PDF output, the HTML indexes look poorer by comparison, as + these use section titles in place of page numbers... but as AutoIndex uses + section titles as index entries this leads to a lot of repetition, so as an + alternative AutoIndex can be instructed to construct the index itself. This + is faster than using the XSL stylesheets, and now each index entry is a hyperlink + to the appropriate section: + </p> +<p> + <span class="inlinemediaobject"><img src="../../students_t_eg_3.png" alt="students_t_eg_3"></span> + </p> +<p> + With internal index generation there is also a helpful navigation bar at the + start of each Index: + </p> +<p> + <span class="inlinemediaobject"><img src="../../students_t_eg_4.png" alt="students_t_eg_4"></span> + </p> +<p> + Finally, you can choose what kind of XML container wraps an internally generated + index - this defaults to <code class="computeroutput"><span class="special"><</span><span class="identifier">section</span><span class="special">>...</</span><span class="identifier">section</span><span class="special">></span></code> + but you can use either command line options or Boost.Build Jamfile features, + to select an alternative wrapper - for example <span class="emphasis"><em>appendix</em></span> + or <span class="emphasis"><em>chapter</em></span> would be good choices, whatever fits best into + the flow of the document. You can even set the container wrapper to type <span class="emphasis"><em>index</em></span> + provided you turn off index generation by the XSL stylesheets, for example + by setting the following build requirements in the Jamfile: + </p> +<pre class="programlisting"><format>html:<auto-index-internal>on # Use internally generated indexes. +<auto-index-type>index # Use <index>...</index> as the XML wrapper. +<format>html:<xsl:param>generate.index=0 # Don't let the XSL stylesheets generate indexes. +</pre> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tut.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/qbk.html b/tools/auto_index/doc/html/boost_autoindex/qbk.html new file mode 100644 index 0000000000..1365b8d2de --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/qbk.html @@ -0,0 +1,229 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Quickbook Support</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="xml.html" title="XML Handling"> +<link rel="next" href="comm_ref.html" title="Command Line Reference"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="xml.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="comm_ref.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.qbk"></a><a class="link" href="qbk.html" title="Quickbook Support">Quickbook Support</a> +</h2></div></div></div> +<p> + The file auto_index_helpers.qbk in <span class="emphasis"><em>boost-path</em></span>/tools/auto_index/include + contains various Quickbook templates to assist with AutoIndex support. One + would normally add the above path to your include search path via an <code class="computeroutput"><span class="special"><</span><span class="identifier">include</span><span class="special">></span><span class="identifier">path</span></code> + statement in your Jamfile, and then make the templates available to your Quickbook + source via a: + </p> +<pre class="programlisting">[include auto_index_helpers.qbk]</pre> +<p> + statement at the start of your Quickbook file. + </p> +<p> + The available templates are then: + </p> +<div class="informaltable"><table class="table"> +<colgroup> +<col> +<col> +</colgroup> +<thead><tr> +<th> + <p> + Template + </p> + </th> +<th> + <p> + Description + </p> + </th> +</tr></thead> +<tbody> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">index</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a main index, with no "type" category set, which + will be titled simply "Index". + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">named_index</span> + <span class="identifier">type</span> <span class="identifier">title</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates an index with the type attribute set to "type" + and the title will be "title".<br> For example to create + an index containing only class names one would typically add <code class="computeroutput"><span class="special">[</span><span class="identifier">named_index</span> + <span class="identifier">class_name</span> <span class="identifier">Class</span> + <span class="identifier">Index</span><span class="special">]</span></code> + to your Quickbook source. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">AutoIndex</span> + <span class="identifier">Arg</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a Docbook processing instruction that will be handled by + AutoIndex, valid values for "Arg" are either "IgnoreSection" + or "IgnoreBlock". + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">indexterm1</span> + <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and have a single primary key "primary-key". Note that + this index key will not have a "type" attribute set, and + so will only appear in the main index. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">indexterm2</span> + <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span> <span class="identifier">secondary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and has "primary-key" and "secondary key" as + the primary and secondary keys respectively. Note that this index + key will not have a "type" attribute set, and so will only + appear in the main index. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">indexterm3</span> + <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span> <span class="identifier">secondary</span><span class="special">-</span><span class="identifier">key</span> + <span class="identifier">tertiary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and have primary, secondary and tertiary keys: "primary-key", + "secondary key" and "tertiary key". Note that + this index key will not have a "type" attribute set, and + so will only appear in the main index. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">typed_indexterm1</span> + <span class="identifier">type</span> <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and have a single primary key "primary-key". Note that + this index key will have the "type" attribute set to the + "type" argument, and so may appear in named sub-indexes + that also have their type attribute set. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">typed_indexterm2</span> + <span class="identifier">type</span> <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span> + <span class="identifier">secondary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and has "primary-key" and "secondary key" as + the primary and secondary keys respectively. Note that this index + key will have the "type" attribute set to the "type" + argument, and so may appear in named sub-indexes that also have their + type attribute set. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special">[</span><span class="identifier">typed_indexterm3</span> + <span class="identifier">type</span> <span class="identifier">primary</span><span class="special">-</span><span class="identifier">key</span> + <span class="identifier">secondary</span><span class="special">-</span><span class="identifier">key</span> <span class="identifier">tertiary</span><span class="special">-</span><span class="identifier">key</span><span class="special">]</span></code> + </p> + </td> +<td> + <p> + Creates a manual index entry that will link to the current section, + and have primary, secondary and tertiary keys: "primary-key", + "secondary key" and "tertiary key". Note that + this index key will have the "type" attribute set to the + "type" argument, and so may appear in named sub-indexes + that also have their type attribute set. + </p> + </td> +</tr> +</tbody> +</table></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="xml.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="comm_ref.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/script_ref.html b/tools/auto_index/doc/html/boost_autoindex/script_ref.html new file mode 100644 index 0000000000..bd994d3d26 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/script_ref.html @@ -0,0 +1,525 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Script File (.idx) Reference</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="tut/refine.html" title="Step 8: Iterate - to refine your index"> +<link rel="next" href="workflow.html" title="Understanding The AutoIndex Workflow"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="tut/refine.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="workflow.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.script_ref"></a><a class="link" href="script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a> +</h2></div></div></div> +<p> + The following elements can occur in a script: + </p> +<a name="boost_autoindex.script_ref.comments_and_blank_lines"></a><h5> +<a name="boost_autoindex.script_ref.comments_and_blank_lines-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.comments_and_blank_lines">Comments + and blank lines</a> + </h5> +<p> + Blank lines consisting of only whitespace are ignored, so are lines that <span class="bold"><strong>start with a #</strong></span>. + </p> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"><p> + You can't append # comments onto the end of a line! + </p></td></tr> +</table></div> +<a name="boost_autoindex.script_ref.inclusion_of_index_terms"></a><h5> +<a name="boost_autoindex.script_ref.inclusion_of_index_terms-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.inclusion_of_index_terms">Inclusion + of Index terms</a> + </h5> +<pre class="programlisting"><span class="identifier">term</span> <span class="special">[</span><span class="identifier">regular</span><span class="special">-</span><span class="identifier">expression1</span> <span class="special">[</span><span class="identifier">regular</span><span class="special">-</span><span class="identifier">expression2</span> <span class="special">[</span><span class="identifier">category</span><span class="special">]]]</span> +</pre> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">term</span></dt> +<dd> +<p> + <span class="emphasis"><em>Term to index.</em></span> + </p> +<p> + The index term will form a primary entry in the Index with the section + title(s) containing the term as secondary entries, and also will be used + as a secondary entry beneath each of the section titles that the index + term occurs in. + </p> +</dd> +<dt><span class="term">regular-expression1</span></dt> +<dd> +<p> + <span class="emphasis"><em>Index term Searcher.</em></span> + </p> +<p> + An optional regular expression: each occurrence of the regular expression + in the text of the document will result in one index term being emitted. + </p> +<p> + If the regular expression is omitted (default) or is "", then + the <span class="emphasis"><em>index term</em></span> itself will be used as the search + text - and only occurrence of whole words matching <span class="emphasis"><em>index term</em></span> + will be indexed. + </p> +<p> + For example: + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">foobar</span></pre> +<p> + </p> +<p> + will index occurrences of "foobar" in any section, but + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">foobar</span> <span class="special">\<\</span><span class="identifier">w</span><span class="special">*(</span><span class="identifier">foo</span><span class="special">|</span><span class="identifier">bar</span><span class="special">)\</span><span class="identifier">w</span><span class="special">*\></span></pre> +<p> + </p> +<p> + will index any whole word containing either "foo" or "bar" + within it. This is useful when you want to index a lot of similar or + related words under one entry. + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">reflex</span></pre> +<p> + </p> +<p> + will only index occurrences of "reflex" as a whole word, but: + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">reflex</span> <span class="special">\<</span><span class="identifier">reflex</span><span class="special">\</span><span class="identifier">w</span><span class="special">*\></span></pre> +<p> + </p> +<p> + will index occurrences of "reflex", "reflexes", "reflexing" + and "reflexed" ... all under the same entry reflex. + </p> +<p> + You will very often need to use this to deal with plurals and other variants. + </p> +</dd> +<dt><span class="term">regular-expression2</span></dt> +<dd> +<p> + <span class="emphasis"><em>Section(s) Selector.</em></span> + </p> +<p> + A constraint that specifies which sections are indexed for <span class="emphasis"><em>term</em></span>: + only if the ID of the section matches <span class="emphasis"><em>regular-expression2</em></span> + exactly will that section be indexed for occurrences of <span class="emphasis"><em>term</em></span>. + </p> +<p> + For example, to limit indexing to just <span class="bold"><strong>one specific + section</strong></span> (but not sub-sections below): + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">myclass</span> <span class="string">""</span> <span class="string">"mylib\.examples"</span></pre> +<p> + </p> +<p> + For example, to limit indexing to specific sections, <span class="bold"><strong>and + sub-sections below</strong></span>: + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">myclass</span> <span class="string">""</span> <span class="string">"mylib\.examples.*"</span></pre> +<p> + </p> +<p> + will index occurrences of "myclass" as a whole word, but only + in sections whose section ID <span class="bold"><strong>begins</strong></span> + "mylib.examples", while + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">myclass</span> <span class="string">"\<myclass\w*\>"</span> <span class="string">"mylib\.examples.*"</span></pre> +<p> + </p> +<p> + will also index plurals myclass, myclasses, myclasss ... + </p> +<p> + and: + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">myclass</span> <span class="string">""</span> <span class="string">"(?!mylib\.introduction).*"</span></pre> +<p> + </p> +<p> + will index occurrences of "myclass" in any section, except + those whose section IDs begin "mylib.introduction". + </p> +<p> + Finally, two (or more) sections can be excluded by OR'ing them together: + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">myclass</span> <span class="string">""</span> <span class="string">"(?!mylib\.introduction|mylib\.reference).*"</span></pre> +<p> + </p> +<p> + which excludes searching for this term in sections whose ID's start with + either "mylib.introduction" or "mylib.reference". + </p> +<p> + If this third section selection field is omitted (the default) or is + "", then <span class="bold"><strong>all sections</strong></span> are + indexed for this term. + </p> +</dd> +<dt><span class="term">category</span></dt> +<dd> +<p> + <span class="emphasis"><em>Index Category Constraint.</em></span> + </p> +<p> + Optionally a category to place occurrences of <span class="emphasis"><em>index term</em></span> + in. If you have multiple indexes then this is the name assigned to the + indexes "type" attribute. + </p> +<p> + For example: + </p> +<p> + myclass "" "" class_name + </p> +<p> + Will index occurances of <span class="emphasis"><em>myclass</em></span> and place them + in the class-index if there is one. + </p> +</dd> +</dl> +</div> +<p> + You can have an index term appear more than once in the script file: + </p> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem"> + If they have different <span class="emphasis"><em>category</em></span> names then they are + treated quite separately. + </li> +<li class="listitem"> + Otherwise they are combined, so that the logical or of the regular expressions + provided are taken. + </li> +</ul></div> +<p> + Thus: + </p> +<pre class="programlisting"><span class="identifier">myterm</span> <span class="identifier">search_expression1</span> <span class="identifier">constrait_expression2</span> <span class="identifier">foo</span> +<span class="identifier">myterm</span> <span class="identifier">search_expression1</span> <span class="identifier">constrait_expression2</span> <span class="identifier">bar</span> +</pre> +<p> + Will be treated as different terms each with their own entries, while: + </p> +<pre class="programlisting"><span class="identifier">myterm</span> <span class="identifier">search_expression1</span> <span class="identifier">constrait_expression2</span> <span class="identifier">mycategory</span> +<span class="identifier">myterm</span> <span class="identifier">search_expression1</span> <span class="identifier">constrait_expression2</span> <span class="identifier">mycategory</span> +</pre> +<p> + Will be combined into a single term equivalent to: + </p> +<pre class="programlisting"><span class="identifier">myterm</span> <span class="special">(?:</span><span class="identifier">search_expression1</span><span class="special">|</span><span class="identifier">search_expression1</span><span class="special">)</span> <span class="special">(?:</span><span class="identifier">constrait_expression2</span><span class="special">|</span><span class="identifier">constrait_expression2</span><span class="special">)</span> <span class="identifier">mycategory</span> +</pre> +<a name="boost_autoindex.script_ref.source_file_scanning"></a><h5> +<a name="boost_autoindex.script_ref.source_file_scanning-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.source_file_scanning">Source File + Scanning</a> + </h5> +<pre class="programlisting"><span class="special">!</span><span class="identifier">scan</span> <span class="identifier">source</span><span class="special">-</span><span class="identifier">file</span><span class="special">-</span><span class="identifier">name</span> +</pre> +<p> + Scans the C/C++ source file <span class="emphasis"><em>source-file-name</em></span> for definitions + of <span class="emphasis"><em>function</em></span>s, <span class="emphasis"><em>class</em></span>s, <span class="emphasis"><em>macro</em></span>s + or <span class="emphasis"><em>typedef</em></span>s and makes each of these a term to be indexed. + Terms found are assigned to the index category "function_name", "class_name", + "macro_name" or "typedef_name" depending on how they were + seen in the source file. These may then be included in a specialised index + whose "type" attribute has the same category name. + </p> +<div class="important"><table border="0" summary="Important"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td> +<th align="left">Important</th> +</tr> +<tr><td align="left" valign="top"><p> + When actually indexing a document, the scanner will not index just any old + occurrence of the terms found in the source files. Instead it searches for + class definitions or function or typedef declarations. This reduces the number + of spurious matches placed in the index, but may also miss some legitimate + terms: refer to the <span class="emphasis"><em>define-scanner</em></span> command for information + on how to change this. + </p></td></tr> +</table></div> +<a name="boost_autoindex.script_ref.directory_and_source_file_scanning"></a><h5> +<a name="boost_autoindex.script_ref.directory_and_source_file_scanning-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.directory_and_source_file_scanning">Directory + and Source File Scanning</a> + </h5> +<pre class="programlisting"><span class="special">!</span><span class="identifier">scan</span><span class="special">-</span><span class="identifier">path</span> <span class="identifier">directory</span><span class="special">-</span><span class="identifier">name</span> <span class="identifier">file</span><span class="special">-</span><span class="identifier">name</span><span class="special">-</span><span class="identifier">regex</span> <span class="special">[</span><span class="identifier">recurse</span><span class="special">]</span> +</pre> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">directory-name</span></dt> +<dd><p> + The directory to scan: this should be a path relative to the script file + (or to the path specified with the prefix=path option on the command + line) and should use all forward slashes in its file name. + </p></dd> +<dt><span class="term">file-name-regex</span></dt> +<dd><p> + A regular expression: any file in the directory whose name matches the + regular expression will be scanned for terms to index. + </p></dd> +<dt><span class="term">recurse</span></dt> +<dd><p> + An optional boolean value - either "true" or "false" + - that indicates whether to recurse into subdirectories. This defaults + to "false". + </p></dd> +</dl> +</div> +<a name="boost_autoindex.script_ref.excluding_terms"></a><h5> +<a name="boost_autoindex.script_ref.excluding_terms-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.excluding_terms">Excluding Terms</a> + </h5> +<pre class="programlisting"><span class="special">!</span><span class="identifier">exclude</span> <span class="identifier">term</span><span class="special">-</span><span class="identifier">list</span> +</pre> +<p> + Excludes all the terms in whitespace separated <span class="emphasis"><em>term-list</em></span> + from being indexed. This should be placed <span class="emphasis"><em>after</em></span> any <span class="emphasis"><em>!scan</em></span> + or <span class="emphasis"><em>!scan-path</em></span> rules which may result in the terms becoming + included. In other words this removes terms from the scanners internal list + of things to index. + </p> +<a name="boost_autoindex.script_ref.rewriting_section_names"></a><h5> +<a name="boost_autoindex.script_ref.rewriting_section_names-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.rewriting_section_names">Rewriting + Section Names</a> + </h5> +<pre class="programlisting">!rewrite-id regular-expression new-name</pre> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">regular-expression</span></dt> +<dd><p> + A regular expression: all section ID's that match the expression exactly + will have index entries <span class="emphasis"><em>new-name</em></span> instead of their + title(s). + </p></dd> +<dt><span class="term">new-name</span></dt> +<dd><p> + The name that the section will appear under in the index. + </p></dd> +</dl> +</div> +<pre class="programlisting"><span class="special">!</span><span class="identifier">rewrite</span><span class="special">-</span><span class="identifier">name</span> <span class="identifier">regular</span><span class="special">-</span><span class="identifier">expression</span> <span class="identifier">format</span><span class="special">-</span><span class="identifier">text</span> +</pre> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">regular-expression</span></dt> +<dd><p> + A regular expression: all sections whose titles match the regular expression + exactly, will have index entries composed of the regular expression match + combined with the regex format string <span class="emphasis"><em>format-text</em></span>. + </p></dd> +<dt><span class="term">format-text</span></dt> +<dd><p> + The Perl-style format string used to reformat the title. + </p></dd> +</dl> +</div> +<p> + For example: + </p> +<pre class="programlisting">!rewrite-name "(?:A|An|The)\s+(.*)" "\1" +</pre> +<p> + Will remove any leading "A", "An" or "The" from + all index entries - thus preventing lots of entries under "The" etc! + </p> +<a name="boost_autoindex.script_ref.defining_or_changing_the_file_scanners"></a><h5> +<a name="boost_autoindex.script_ref.defining_or_changing_the_file_scanners-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.defining_or_changing_the_file_scanners">Defining + or Changing the File Scanners</a> + </h5> +<pre class="programlisting"><span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="identifier">type</span> <span class="identifier">file</span><span class="special">-</span><span class="identifier">search</span><span class="special">-</span><span class="identifier">expression</span> <span class="identifier">xml</span><span class="special">-</span><span class="identifier">regex</span><span class="special">-</span><span class="identifier">formatter</span> <span class="identifier">term</span><span class="special">-</span><span class="identifier">formatter</span> <span class="identifier">id</span><span class="special">-</span><span class="identifier">filter</span> <span class="identifier">filename</span><span class="special">-</span><span class="identifier">filter</span> +</pre> +<p> + When a source file is scanned using the <code class="literal">!scan</code> or <code class="literal">!scan-path</code> + rules, then the file is searched using a series of regular expressions to look + for classes, functions, macros or typedefs that should be indexed. A set of + default regular expressions are provided for this (see below), but sometimes + you may want to replace the defaults, or add new scanners. The arguments to + this rule are: + </p> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term">type</span></dt> +<dd><p> + The <span class="emphasis"><em>type</em></span> to which items found using this rule will + assigned, index terms created from the source file and then found in + the XML, will have the type attribute set to this value, and may then + appear in a specialized index with the same type attribute + </p></dd> +<dt><span class="term">file-search-expression</span></dt> +<dd><p> + A regular expression that is used to scan the source file for index terms, + the result of a match against this expression will be transformed by + the next two arguments. + </p></dd> +<dt><span class="term">xml-regex-formatter</span></dt> +<dd><p> + A regular expression format string that extracts the salient information + from whatever matched the <span class="emphasis"><em>file-search-expression</em></span> + in the source file, and creates <span class="emphasis"><em>a new regular expression</em></span> + that will be used to search the document being indexed for occurrences + of this index term. + </p></dd> +<dt><span class="term">term-formatter</span></dt> +<dd><p> + A regular expression format string that extracts the salient information + from whatever matched the <span class="emphasis"><em>file-search-expression</em></span> + in the source file, and creates the index term that will appear in the + index. + </p></dd> +<dt><span class="term">id-filter</span></dt> +<dd><p> + Optional. A regular expression that restricts the section-id's that are + searched in the document being indexed: only sections whose ID attribute + matches this expression exactly will be considered for indexing terms + found by this scanner. + </p></dd> +<dt><span class="term">filename-filter</span></dt> +<dd><p> + Optional. A regular expression that restricts which files are scanned + by this scanner: only files whose file name matches this expression exactly + will be scanned for index terms to use. Note that the filename matched + against this may well be an absolute path, and contain either forward + or backward slash path separators. + </p></dd> +</dl> +</div> +<p> + If, when the first file is scanned, there are no scanners whose <span class="emphasis"><em>type</em></span> + is "class_name", "typedef_name", "macro_name" + or "function_name", then the defaults are installed. These are equivalent + to: + </p> +<pre class="programlisting"><span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="identifier">class_name</span> <span class="string">"^[[:space:]]*(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\<\w+\>([[:blank:]]*\([^)]*\))?[[:space:]]*)*(\<\w*\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\{|:[^;\{()]*\{)"</span> <span class="string">"(?:class|struct)[^;{]+\\<\5\\>[^;{]+\\{"</span> <span class="special">\</span><span class="number">5</span> +<span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="identifier">typedef_name</span> <span class="string">"typedef[^;{}#]+?(\w+)\s*;"</span> <span class="string">"typedef[^;]+\\<\1\\>\\s*;"</span> <span class="string">"\1"</span> +<span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="string">"macro_name"</span> <span class="string">"^\s*#\s*define\s+(\w+)"</span> <span class="string">"\\<\1\\>"</span> <span class="string">"\1"</span> +<span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="string">"function_name"</span> <span class="string">"\w+(?:\s*<[^>]>)?[\s&*]+?(\w+)\s*(?:BOOST_[[:upper:]_]+\s*)?\([^\)]*\)\s*[;{]"</span> <span class="string">"\\<\\w+\\>(?:\\s+<[^>]*>)?[\\s&*]+\\<\1\\>\\s*\\([^;{]*\\)"</span> <span class="string">"\1"</span> +</pre> +<p> + Note that these defaults are not installed if you have provided your own versions + with these <span class="emphasis"><em>type</em></span> names. In this case if you want the default + scanners to be in effect as well as your own, you should include the above + in your script file. It is also perfectly allowable to have multiple scanners + with the same <span class="emphasis"><em>type</em></span>, but with the other fields differing. + </p> +<p> + Finally you should note that the default scanners are quite strict in what + they will find, for example the class scanner will only create index entries + for classes that have class definitions of the form: + </p> +<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">my_class</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">base_classes</span> +<span class="special">{</span> + <span class="comment">// etc</span> +</pre> +<p> + In the documentation, so that simple mentions of the class name will <span class="emphasis"><em>not</em></span> + get indexed, only the class synopsis if there is one. If this isn't how you + want things, then include the <span class="emphasis"><em>class_name</em></span> scanner definition + above in your script file, and change the <span class="emphasis"><em>xml-regex-formatter</em></span> + field to something more permissive, for example: + </p> +<pre class="programlisting"><span class="special">!</span><span class="identifier">define</span><span class="special">-</span><span class="identifier">scanner</span> <span class="identifier">class_name</span> <span class="string">"^[[:space:]]*(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\<\w+\>([[:blank:]]*\([^)]*\))?[[:space:]]*)*(\<\w*\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\{|:[^;\{()]*\{)"</span> <span class="string">"\\<\5\\>"</span> <span class="special">\</span><span class="number">5</span> +</pre> +<p> + Will look for <span class="emphasis"><em>any</em></span> occurrence of whatever class names the + scanner may find in the documentation. + </p> +<a name="boost_autoindex.script_ref.debugging_scanning"></a><h5> +<a name="boost_autoindex.script_ref.debugging_scanning-heading"></a> + <a class="link" href="script_ref.html#boost_autoindex.script_ref.debugging_scanning">Debugging scanning</a> + </h5> +<p> + If you see a term in the index, and you don't understand why it's there, add + a <span class="emphasis"><em>debug</em></span> directive: + </p> +<pre class="programlisting">!debug regular-expression +</pre> +<p> + Now, whenever <span class="emphasis"><em>regular-expression</em></span> matches either the found + index term, or the section title it appears in, or the <span class="emphasis"><em>type</em></span> + field of a scanner, then some diagnostic information will be printed that will + look something like: + </p> +<pre class="programlisting">Debug term found, in block with ID: spirit.qi.reference.parser_concepts.parser +Current section title is: Notation +The main index entry will be : Notation +The indexed term is: parser +The search regex is: [P|p]arser +The section constraint is: .<span class="bold"><strong>qi.reference.parser_concepts.</strong></span> +The index type for this entry is: qi_index +</pre> +<p> + This can produce a lot of output in your log file, but until you are satisfied + with your file selection and scanning process, it is worth switching it on. + </p> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="tut/refine.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="workflow.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut.html b/tools/auto_index/doc/html/boost_autoindex/tut.html new file mode 100644 index 0000000000..646e441041 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut.html @@ -0,0 +1,66 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Getting Started and Tutorial</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="overview.html" title="Overview"> +<link rel="next" href="tut/build.html" title="Step 1: Build the AutoIndex tool"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="overview.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tut/build.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.tut"></a><a class="link" href="tut.html" title="Getting Started and Tutorial">Getting Started and Tutorial</a> +</h2></div></div></div> +<div class="toc"><dl> +<dt><span class="section"><a href="tut/build.html">Step 1: Build the AutoIndex + tool</a></span></dt> +<dt><span class="section"><a href="tut/configure.html">Step 2: Configure Boost.Build + jamfile to use AutoIndex</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="tut/configure/options.html">Available Indexing + Options</a></span></dt> +<dt><span class="section"><a href="tut/configure/optional.html">Making AutoIndex + optional</a></span></dt> +</dl></dd> +<dt><span class="section"><a href="tut/add_indexes.html">Step 3: Add indexes + to your documentation</a></span></dt> +<dt><span class="section"><a href="tut/script.html">Step 4: Create the .idx script + file - to control what to terms to index</a></span></dt> +<dt><span class="section"><a href="tut/entries.html">Step 5: Add Manual Index + Entries to Docbook XML - Optional</a></span></dt> +<dt><span class="section"><a href="tut/pis.html">Step 6: Using XML processing + instructions to control what gets indexed.</a></span></dt> +<dt><span class="section"><a href="tut/build_docs.html">Step 7: Build the Docs</a></span></dt> +<dt><span class="section"><a href="tut/refine.html">Step 8: Iterate - to refine + your index</a></span></dt> +</dl></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="overview.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tut/build.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/add_indexes.html b/tools/auto_index/doc/html/boost_autoindex/tut/add_indexes.html new file mode 100644 index 0000000000..d2fff87172 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/add_indexes.html @@ -0,0 +1,173 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 3: Add indexes to your documentation</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="configure/optional.html" title="Making AutoIndex optional"> +<link rel="next" href="script.html" title="Step 4: Create the .idx script file - to control what to terms to index"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="configure/optional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="script.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.add_indexes"></a><a class="link" href="add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes + to your documentation</a> +</h3></div></div></div> +<p> + To add a single "include everything" index to a BoostBook/Docbook + document, (perhaps generated using Quickbook, and perhaps also using Doxygen + reference section), add <code class="computeroutput"><span class="special"><</span><span class="identifier">index</span><span class="special">/></span></code> + at the location where you want the index to appear. The index will be rendered + as a separate section called "Index" when the documentation is + built. + </p> +<p> + To add multiple indexes, then give each one a title and set its <code class="computeroutput"><span class="identifier">type</span></code> attribute to specify which terms will + be included, for example to place the <span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>class</em></span>, + <span class="emphasis"><em>macro</em></span> or <span class="emphasis"><em>typedef</em></span> names indexed + by <span class="emphasis"><em>AutoIndex</em></span> in separate indexes along with a main "include + everything" index as well, one could add: + </p> +<pre class="programlisting"><index type="class_name"> +<title>Class Index</title> +</index> + +<index type="typedef_name"> +<title>Typedef Index</title> +</index> + +<index type="function_name"> +<title>Function Index</title> +</index> + +<index type="macro_name"> +<title>Macro Index</title> +</index> + +<index/> +</pre> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"><p> + Multiple indexes like this only work correctly if you tell the XSL stylesheets + to honor the "type" attribute on each index as by default . You + can turn the feature on by adding <code class="computeroutput"><span class="special"><</span><span class="identifier">xsl</span><span class="special">:</span><span class="identifier">param</span><span class="special">></span><span class="identifier">index</span><span class="special">.</span><span class="identifier">on</span><span class="special">.</span><span class="identifier">type</span><span class="special">=</span><span class="number">1</span></code> to your + projects requirements in the Jamfile. + </p></td></tr> +</table></div> +<p> + In Quickbook, you add the same markup but enclose it between two triple-tick + ''' escapes, thus + </p> +<pre class="programlisting">'''<index/>''' </pre> +<p> + Or more easily via the helper file auto_index_helpers.qbk, so that given: + </p> +<pre class="programlisting">[include auto_index_helpers.qbk]</pre> +<p> + one can simply write: + </p> +<pre class="programlisting">[named_index class_name Class Index] +[named_index function_name Function Index] +[named_index typedef_name Typedef Index] +[named_index macro_name Macro Index] +[index] +</pre> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"><p> + AutoIndex knows nothing of the XML <code class="computeroutput"><span class="identifier">xinclude</span></code> + element, so if you're writing raw Docbook XML then you may want to run + this through an XSL processor to flatten everything to one XML file before + passing to AutoIndex. If you're using Boostbook or quickbook though, this + all happens for you anyway, and AutoIndex will index the whole document + including any sections included with <code class="computeroutput"><span class="identifier">xinclude</span></code>. + </p></td></tr> +</table></div> +<p> + If you are using AutoIndex's internal index generation on + </p> +<pre class="programlisting"><auto-index-internal>on +</pre> +<p> + (usually recommended for HTML output, but <span class="emphasis"><em>not</em></span> the default) + then you can also decide what kind of XML wrapper the generated index is + placed in. By default this is a <code class="computeroutput"><span class="special"><</span><span class="identifier">section</span><span class="special">>...</</span><span class="identifier">section</span><span class="special">></span></code> + XML block (this replaces the original <code class="computeroutput"><span class="special"><</span><span class="identifier">index</span><span class="special">>...</</span><span class="identifier">index</span><span class="special">></span></code> + block). However, depending upon the structure of the document and whether + or not you want the index on a separate page - or else on the front page + after the TOC - you may want to place the index inside a different type of + XML block. For example if your document uses <code class="computeroutput"><span class="special"><</span><span class="identifier">chapter</span><span class="special">></span></code> + top level content rather than <code class="computeroutput"><span class="special"><</span><span class="identifier">section</span><span class="special">></span></code>s + then it may be preferable to place the index in a <code class="computeroutput"><span class="special"><</span><span class="identifier">chapter</span><span class="special">></span></code> + or <code class="computeroutput"><span class="special"><</span><span class="identifier">appendix</span><span class="special">></span></code> block. You can also place the index inside + an <code class="computeroutput"><span class="special"><</span><span class="identifier">index</span><span class="special">></span></code> block if you prefer, in which case the + index does not appear in on a page of its own, but after the TOC in the HTML + output. + </p> +<p> + You control the type of XML block used by setting the <code class="literal"><auto-index-type>element-name</code> + attribute in the Jamfile, or via the <code class="computeroutput"><span class="identifier">index</span><span class="special">-</span><span class="identifier">type</span><span class="special">=</span><span class="identifier">element</span><span class="special">-</span><span class="identifier">name</span></code> command line option to AutoIndex itself. + For example, to place the index in an appendix, your Jamfile might look like: + </p> +<pre class="programlisting">using quickbook ; +using auto-index ; + +xml mylibrary : mylibary.qbk ; +boostbook standalone + : + mylibrary + : + # auto-indexing is on: + <auto-index>on + + # PDFs rely on the XSL stylesheets to generate the index: + <format>pdf:<auto-index-internal>off + + # HTML output uses auto-index to generate the index: + <format>html:<auto-index-internal>on + + # Name of script file to use: + <auto-index-script>index.idx + + # Set the XML wrapper for HML Indexes to "appendix": + <format>html:<auto-index-type>appendix + + # Turn on multiple index support: + <xsl:param>index.on.type=1 +</pre> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="configure/optional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="script.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/build.html b/tools/auto_index/doc/html/boost_autoindex/tut/build.html new file mode 100644 index 0000000000..a5815d9012 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/build.html @@ -0,0 +1,90 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 1: Build the AutoIndex tool</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="next" href="configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../tut.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="configure.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.build"></a><a class="link" href="build.html" title="Step 1: Build the AutoIndex tool">Step 1: Build the AutoIndex + tool</a> +</h3></div></div></div> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"><p> + This step is strictly optional, but very desirable to speed up build times. + </p></td></tr> +</table></div> +<p> + cd into <code class="computeroutput"><span class="identifier">tools</span><span class="special">/</span><span class="identifier">auto_index</span><span class="special">/</span><span class="identifier">build</span></code> and invoke bjam as: + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">release</span> +</pre> +<p> + Optionally pass the name of the compiler toolset you want to use to bjam + as well: + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">release</span> <span class="identifier">gcc</span> +</pre> +<p> + This will build the tool and place a copy in the current directory (which + is to say <code class="computeroutput"><span class="identifier">tools</span><span class="special">/</span><span class="identifier">auto_index</span><span class="special">/</span><span class="identifier">build</span></code>) + </p> +<p> + Now open up your <code class="computeroutput"><span class="identifier">user</span><span class="special">-</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">jam</span></code> file and at the end of the file add + the line: + </p> +<pre class="programlisting">using auto-index : <span class="emphasis"><em>full-path-to-boost-tree</em></span>/tools/auto_index/build/auto-index.exe ; +</pre> +<div class="note"><table border="0" summary="Note"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> +<th align="left">Note</th> +</tr> +<tr><td align="left" valign="top"> +<p> + This declaration must go towards the end of <code class="computeroutput"><span class="identifier">user</span><span class="special">-</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">jam</span></code>, + or in any case after the Boostbook initialisation. + </p> +<p> + Also note that Windows users must use forward slashes in the paths in + <code class="computeroutput"><span class="identifier">user</span><span class="special">-</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">jam</span></code> + </p> +</td></tr> +</table></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../tut.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="configure.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/build_docs.html b/tools/auto_index/doc/html/boost_autoindex/tut/build_docs.html new file mode 100644 index 0000000000..d87ec8b2bd --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/build_docs.html @@ -0,0 +1,77 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 7: Build the Docs</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."> +<link rel="next" href="refine.html" title="Step 8: Iterate - to refine your index"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="pis.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="refine.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.build_docs"></a><a class="link" href="build_docs.html" title="Step 7: Build the Docs">Step 7: Build the Docs</a> +</h3></div></div></div> +<p> + Using Boost.Build you build the docs with either: + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">release</span> <span class="special">></span> <span class="identifier">mylibrary_html</span><span class="special">.</span><span class="identifier">log</span> +</pre> +<p> + To build the html docs or: + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">pdf</span> <span class="identifier">release</span> <span class="special">></span> <span class="identifier">mylibrary_pdf</span><span class="special">.</span><span class="identifier">log</span> +</pre> +<p> + To build the pdf. + </p> +<p> + During the build process you should see AutoIndex emit a message in the log + file such as: + </p> +<pre class="programlisting">Indexing 990 terms... </pre> +<p> + If you don't see that, or if it's indexing 0 terms then something is wrong! + </p> +<p> + Likewise when index generation is complete, AutoIndex will emit another message: + </p> +<pre class="programlisting">38 Index entries were created.</pre> +<p> + Again, if you see that 0 entries were created then something is wrong! + </p> +<p> + Examine the log file, and if the cause is not obvious, make sure that you + have <code class="literal"><auto-index-verbose>on</code> and that any needed + <code class="literal">!debug regular-expression</code> directives are in your script + file. + </p> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="pis.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="refine.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/configure.html b/tools/auto_index/doc/html/boost_autoindex/tut/configure.html new file mode 100644 index 0000000000..451d32a78a --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/configure.html @@ -0,0 +1,139 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 2: Configure Boost.Build jamfile to use AutoIndex</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="build.html" title="Step 1: Build the AutoIndex tool"> +<link rel="next" href="configure/options.html" title="Available Indexing Options"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="build.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="configure/options.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.configure"></a><a class="link" href="configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build + jamfile to use AutoIndex</a> +</h3></div></div></div> +<div class="toc"><dl> +<dt><span class="section"><a href="configure/options.html">Available Indexing + Options</a></span></dt> +<dt><span class="section"><a href="configure/optional.html">Making AutoIndex + optional</a></span></dt> +</dl></div> +<p> + Assuming you have a Jamfile for building your documentation that looks something + like: + </p> +<pre class="programlisting">boostbook standalone + : + mylibrary + : + # build requirements go here: + ; +</pre> +<p> + Then add the line: + </p> +<pre class="programlisting">using auto-index ; </pre> +<p> + to the start of the Jamfile, and then add whatever auto-index options you + want to the <span class="emphasis"><em>build requirements section</em></span>, for example: + </p> +<pre class="programlisting">boostbook standalone + : + mylibrary + : + # Build requirements go here: + + # <auto-index>on (or off) one turns on (or off) indexing: + <auto-index>on + + # Turns on (or off) auto-index-verbose for diagnostic info. + # This is highly recommended until you have got all the many details correct! + <auto-index-verbose>on + + # Choose the indexing method (separately for html and PDF) - see manual. + # Choose indexing method for PDFs: + <format>pdf:<auto-index-internal>off + + # Choose indexing method for html: + <format>html:<auto-index-internal>on + + # Set the name of the script file to use (index.idx is popular): + <auto-index-script>index.idx + # Commands in the script file should all use RELATIVE PATHS + # otherwise the script will not be portable to other machines. + # Relative paths are normally taken as relative to the location + # of the script file, but we can add a prefix to all + # those relative paths using the <auto-index-prefix> feature. + # The path specified by <auto-index-prefix> may be either relative or + # absolute, for example the following will get us up to the boost root + # directory for most Boost libraries: + <auto-index-prefix>../../.. + + # Tell Quickbook that it should enable indexing. + <quickbook-define>enable_index ; + + ; +</pre> +<div class="tip"><table border="0" summary="Tip"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> +<th align="left">Tip</th> +</tr> +<tr><td align="left" valign="top"><p> + Always send the output to a log file. It will contain of lot of stuff, + but is invaluable to check if all has gone right, or else diagnose what + has gone wrong. + </p></td></tr> +</table></div> +<div class="tip"><table border="0" summary="Tip"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> +<th align="left">Tip</th> +</tr> +<tr><td align="left" valign="top"><p> + A return code of 0 is not a reliable indication that you have got what + you really want - inspecting the log file is the only certain way. + </p></td></tr> +</table></div> +<div class="tip"><table border="0" summary="Tip"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> +<th align="left">Tip</th> +</tr> +<tr><td align="left" valign="top"><p> + If you upgrade compiler version, for example MSVC from 9 to 10, then you + may need to rebuild Autoindex to avoid what Microsoft call a 'side-by-side' + error. And make sure that the autoindex.exe version you are using is the + new one. + </p></td></tr> +</table></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="build.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="configure/options.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/configure/optional.html b/tools/auto_index/doc/html/boost_autoindex/tut/configure/optional.html new file mode 100644 index 0000000000..510144a0d3 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/configure/optional.html @@ -0,0 +1,106 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Making AutoIndex optional</title> +<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"> +<link rel="prev" href="options.html" title="Available Indexing Options"> +<link rel="next" href="../add_indexes.html" title="Step 3: Add indexes to your documentation"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="options.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.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="../add_indexes.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h4 class="title"> +<a name="boost_autoindex.tut.configure.optional"></a><a class="link" href="optional.html" title="Making AutoIndex optional">Making AutoIndex + optional</a> +</h4></div></div></div> +<p> + It is considerate to make the <span class="bold"><strong>use of auto-index optional</strong></span> + in Boost.Build, to allow users who do not have AutoIndex installed to still + be able to build your documentation. + </p> +<p> + This also very convenient while you are refining your documentation, to + allow you to decide to build indexes, or not: building indexes can take + long time, if you are just correcting typos, you won't want to wait while + you keep rebuilding the index! + </p> +<p> + One method of setting up optional AutoIndex support is to place all AutoIndex + configuration in a the body of a bjam if statement: + </p> +<pre class="programlisting">if --enable-index in [ modules.peek : ARGV ] + { + ECHO "Building the docs with automatic index generation enabled." ; + + using auto-index ; + project : requirements + <auto-index>on + <auto-index-script>index.idx + + ... other AutoIndex options here... + + # And tell Quickbook that it should enable indexing. + <quickbook-define>enable_index + ; + } + else + { + ECHO "Building the my_library docs with automatic index generation disabled. To get an Index, try building with --enable-index." ; + } +</pre> +<p> + You will also need to add a conditional statement at the end of your Quickbook + file, so that the index(es) is/are only added after the last section if + indexing is enabled. + </p> +<pre class="programlisting">[? enable_index +''' + <index/> +''' +] +</pre> +<p> + To use this jamfile, you need to cd to your docs folder, for example: + </p> +<pre class="programlisting"><span class="identifier">cd</span> <span class="special">\</span><span class="identifier">boost</span><span class="special">-</span><span class="identifier">sandbox</span><span class="special">\</span><span class="identifier">guild</span><span class="special">\</span><span class="identifier">mylibrary</span><span class="special">\</span><span class="identifier">libs</span><span class="special">\</span><span class="identifier">mylibrary</span><span class="special">\</span><span class="identifier">doc</span> +</pre> +<p> + and then run <code class="computeroutput"><span class="identifier">bjam</span></code> to build + the docs without index, for example: + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="special">-</span><span class="identifier">a</span> <span class="identifier">html</span> <span class="special">></span> <span class="identifier">mylibrary_html</span><span class="special">.</span><span class="identifier">log</span> +</pre> +<p> + or with index(es) + </p> +<pre class="programlisting"><span class="identifier">bjam</span> <span class="special">-</span><span class="identifier">a</span> <span class="identifier">html</span> <span class="special">--</span><span class="identifier">enable</span><span class="special">-</span><span class="identifier">index</span> <span class="special">></span> <span class="identifier">mylibrary_html_index</span><span class="special">.</span><span class="identifier">log</span> +</pre> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="options.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.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="../add_indexes.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/configure/options.html b/tools/auto_index/doc/html/boost_autoindex/tut/configure/options.html new file mode 100644 index 0000000000..b28501b99b --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/configure/options.html @@ -0,0 +1,419 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Available Indexing Options</title> +<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"> +<link rel="prev" href="../configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"> +<link rel="next" href="optional.html" title="Making AutoIndex optional"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../configure.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.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="optional.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h4 class="title"> +<a name="boost_autoindex.tut.configure.options"></a><a class="link" href="options.html" title="Available Indexing Options">Available Indexing + Options</a> +</h4></div></div></div> +<p> + The available options are: + </p> +<div class="variablelist"> +<p class="title"><b></b></p> +<dl> +<dt><span class="term"><auto-index>off/on</span></dt> +<dd><p> + Turns indexing of the document on, defaults to "off", so + be sure to set this if you want AutoIndex invoked! + </p></dd> +<dt><span class="term"><auto-index-internal>off/on</span></dt> +<dd><p> + Chooses whether AutoIndex creates the index itself (feature on), + or whether it simply inserts the necessary DocBook markup so that + the DocBook XSL stylesheets can create the index. Defaults to "off". + </p></dd> +<dt><span class="term"><auto-index-script>filename</span></dt> +<dd><p> + Specifies the name of the script to load. + </p></dd> +<dt><span class="term"><auto-index-no-duplicates>off/on</span></dt> +<dd><p> + When <span class="emphasis"><em>on</em></span> AutoIndex will only index a term once + in any given section, otherwise (the default) multiple index entries + per term may be created if the term occurs more than once in the + section. + </p></dd> +<dt><span class="term"><auto-index-section-names>off/on</span></dt> +<dd><p> + When <span class="emphasis"><em>on</em></span> AutoIndex will use create two index + entries for each term found - one uses the term itself as the primary + index key, the other uses the enclosing section name. When off the + index entry that uses the section title is not created. Defaults + to "on" + </p></dd> +<dt><span class="term"><auto-index-verbose>off/on</span></dt> +<dd><p> + Defaults to "off". When turned on AutoIndex prints progress + information - useful for debugging purposes during setup. + </p></dd> +<dt><span class="term"><auto-index-prefix>filename</span></dt> +<dd> +<p> + Optionally specifies a directory to apply as a prefix to all relative + file paths in the script file. + </p> +<p> + You may wish to do this to reduce typing of pathnames, and/or where + the paths can't be located relative to the script file location, + typically if the headers are in the Boost trunk, but the script file + is in Boost sandbox. + </p> +<p> + For Boost standard library layout, <code class="literal"><auto-index-prefix>../../..</code> + will get you back up to the 'root' of the Boost tree, so <code class="literal">!scan-path + boost/mylibrary/</code> is where your headers will be, and <code class="literal">libs/mylibrary</code> + for other files. Without a prefix all relative paths are relative + to the location of the script file. + </p> +</dd> +<dt><span class="term"><auto-index-type>element-name</span></dt> +<dd><p> + Specifies the name of the XML element in which to enclose an internally + generated indexes: defaults to <span class="emphasis"><em>section</em></span>, but + could equally be <span class="emphasis"><em>appendix</em></span> or <span class="emphasis"><em>chapter</em></span> + or some other block level element that has a formal title. The actual + list of available options depends upon the Quickbook document type, + the following table gives the available options, assuming that the + index is placed at the top level, and not in some sub-section or + other container: + </p></dd> +</dl> +</div> +<div class="informaltable"><table class="table"> +<colgroup> +<col> +<col> +</colgroup> +<thead><tr> +<th> + <p> + Document Type + </p> + </th> +<th> + <p> + Permitted Index Types + </p> + </th> +</tr></thead> +<tbody> +<tr> +<td> + <p> + book + </p> + </td> +<td> + <p> + appendix index article chapter reference part + </p> + </td> +</tr> +<tr> +<td> + <p> + article + </p> + </td> +<td> + <p> + section appendix index sect1 + </p> + </td> +</tr> +<tr> +<td> + <p> + chapter + </p> + </td> +<td> + <p> + section index sect1 + </p> + </td> +</tr> +<tr> +<td> + <p> + library + </p> + </td> +<td> + <p> + The same as Chapter (section index sect1) + </p> + </td> +</tr> +<tr> +<td> + <p> + part + </p> + </td> +<td> + <p> + appendix index article chapter reference + </p> + </td> +</tr> +<tr> +<td> + <p> + appendix + </p> + </td> +<td> + <p> + section index sect1 + </p> + </td> +</tr> +<tr> +<td> + <p> + preface + </p> + </td> +<td> + <p> + section index sect1 + </p> + </td> +</tr> +<tr> +<td> + <p> + qandadiv + </p> + </td> +<td> + <p> + N/A: an index would have to be placed within a subsection of + the document. + </p> + </td> +</tr> +<tr> +<td> + <p> + qandaset + </p> + </td> +<td> + <p> + N/A: an index would have to be placed within a subsection of + the document. + </p> + </td> +</tr> +<tr> +<td> + <p> + reference + </p> + </td> +<td> + <p> + N/A: an index would have to be placed within a subsection of + the document. + </p> + </td> +</tr> +<tr> +<td> + <p> + set + </p> + </td> +<td> + <p> + N/A: an index would have to be placed within a subsection of + the document. + </p> + </td> +</tr> +</tbody> +</table></div> +<p> + In large part then the choice of <code class="computeroutput"><span class="special"><</span><span class="keyword">auto</span><span class="special">-</span><span class="identifier">index</span><span class="special">-</span><span class="identifier">type</span><span class="special">></span><span class="identifier">element</span><span class="special">-</span><span class="identifier">name</span></code> + depends on the formatting you want to be applied to the index: + </p> +<div class="informaltable"><table class="table"> +<colgroup> +<col> +<col> +</colgroup> +<thead><tr> +<th> + <p> + XML Container Used for the Index + </p> + </th> +<th> + <p> + Formatting Applied by the XSL Stylesheets + </p> + </th> +</tr></thead> +<tbody> +<tr> +<td> + <p> + appendix + </p> + </td> +<td> + <p> + Starts a new page. + </p> + </td> +</tr> +<tr> +<td> + <p> + article + </p> + </td> +<td> + <p> + Starts a new page. + </p> + </td> +</tr> +<tr> +<td> + <p> + chapter + </p> + </td> +<td> + <p> + Starts a new page. + </p> + </td> +</tr> +<tr> +<td> + <p> + index + </p> + </td> +<td> + <p> + Starts a new page only if it's contained within an article or + book. + </p> + </td> +</tr> +<tr> +<td> + <p> + part + </p> + </td> +<td> + <p> + Starts a new page. + </p> + </td> +</tr> +<tr> +<td> + <p> + reference + </p> + </td> +<td> + <p> + Starts a new page. + </p> + </td> +</tr> +<tr> +<td> + <p> + sect1 + </p> + </td> +<td> + <p> + Starts a new page as long as it's not the first section (but + is controlled by the XSL parameters chunk.section.depth and/or + chunk.first.sections). + </p> + </td> +</tr> +<tr> +<td> + <p> + section + </p> + </td> +<td> + <p> + Starts a new page as long as it's not the first section or nested + within another section (but is controlled by the XSL parameters + chunk.section.depth and/or chunk.first.sections). + </p> + </td> +</tr> +</tbody> +</table></div> +<p> + In almost all cases the default (section) is the correct choice - the exception + is when the index is to be placed directly inside a <span class="emphasis"><em>book</em></span> + or <span class="emphasis"><em>part</em></span>, in which case you should probably use the + same XML container for the index as you use for whatever subdivisions are + in the <span class="emphasis"><em>book</em></span> or <span class="emphasis"><em>part</em></span>. In any event + placing a <span class="emphasis"><em>section</em></span> within a <span class="emphasis"><em>book</em></span> + or <span class="emphasis"><em>part</em></span> will result in invalid XML. + </p> +<p> + Finally, if you are using Quickbook to generate the documentation, then + you may wish to add: + </p> +<pre class="programlisting"><include>$boost-root/tools/auto_index/include</pre> +<p> + to your projects requirements (replacing $boost-root with the path to the + root of the Boost tree), so that the file auto_index_helpers.qbk can be + included in your quickbook source with simply a: + </p> +<pre class="programlisting">[include auto_index_helpers.qbk]</pre> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../configure.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.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="optional.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/entries.html b/tools/auto_index/doc/html/boost_autoindex/tut/entries.html new file mode 100644 index 0000000000..82dcc8f02f --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/entries.html @@ -0,0 +1,62 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 5: Add Manual Index Entries to Docbook XML - Optional</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="script.html" title="Step 4: Create the .idx script file - to control what to terms to index"> +<link rel="next" href="pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="script.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="pis.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.entries"></a><a class="link" href="entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Step 5: Add Manual Index + Entries to Docbook XML - Optional</a> +</h3></div></div></div> +<p> + If you add manual <code class="computeroutput"><span class="special"><</span><span class="identifier">indexentry</span><span class="special">></span></code> markup to your Docbook XML then these + will be passed through unchanged. Please note however, that if you are using + AutoIndex's internal index generation then it only recognises <code class="computeroutput"><span class="special"><</span><span class="identifier">primary</span><span class="special">></span></code>, <code class="computeroutput"><span class="special"><</span><span class="identifier">secondary</span><span class="special">></span></code> + and <code class="computeroutput"><span class="special"><</span><span class="identifier">tertiary</span><span class="special">></span></code> elements within the <code class="computeroutput"><span class="special"><</span><span class="identifier">indexterm</span><span class="special">></span></code>. + <code class="computeroutput"><span class="special"><</span><span class="identifier">see</span><span class="special">></span></code> and <code class="computeroutput"><span class="special"><</span><span class="identifier">seealso</span><span class="special">></span></code> + elements are not currently recognised and AutoIndex will emit a warning if + these are used. + </p> +<p> + Likewise none of the attributes which can be applied to these elements are + used when AutoIndex generates the index itself, with the exception of the + <code class="computeroutput"><span class="special"><</span><span class="identifier">type</span><span class="special">></span></code> attribute. + </p> +<p> + For Quickbook users, there are some templates in auto_index_helpers.qbk that + assist in adding manual entries without having to escape to Docbook. + </p> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="script.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="pis.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/pis.html b/tools/auto_index/doc/html/boost_autoindex/tut/pis.html new file mode 100644 index 0000000000..e937fee48a --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/pis.html @@ -0,0 +1,131 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 6: Using XML processing instructions to control what gets indexed.</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"> +<link rel="next" href="build_docs.html" title="Step 7: Build the Docs"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="entries.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="build_docs.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.pis"></a><a class="link" href="pis.html" title="Step 6: Using XML processing instructions to control what gets indexed.">Step 6: Using XML processing + instructions to control what gets indexed.</a> +</h3></div></div></div> +<p> + Sometimes when you need to exclude certain sections of text from indexing, + then you can achieve this with the following XML processing instructions: + </p> +<div class="informaltable"><table class="table"> +<colgroup> +<col> +<col> +</colgroup> +<thead><tr> +<th> + <p> + Instruction + </p> + </th> +<th> + <p> + Effect + </p> + </th> +</tr></thead> +<tbody> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special"><?</span><span class="identifier">BoostAutoIndex</span> + <span class="identifier">IgnoreSection</span><span class="special">?></span></code> + </p> + </td> +<td> + <p> + Causes the whole of the current section to be excluded from indexing. + By "section" we mean either a true "section" + or any sibling XML element: "dedication", "toc", + "lot", "glossary", "bibliography", + "preface", "chapter", "reference", + "part", "article", "appendix", "index", + "setindex", "colophon", "sect1", + "refentry", "simplesect", "section" + or "partintro". + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="special"><?</span><span class="identifier">BoostAutoIndex</span> + <span class="identifier">IgnoreBlock</span><span class="special">?></span></code> + </p> + </td> +<td> + <p> + Causes the whole of the current text block to be excluded from + indexing. A text block may be any of the section/chapter elements + listed above, or a paragraph, code listing, table etc. The complete + list is: "calloutlist", "glosslist", "bibliolist", + "itemizedlist", "orderedlist", "segmentedlist", + "simplelist", "variablelist", "caution", + "important", "note", "tip", "warning", + "literallayout", "programlisting", "programlistingco", + "screen", "screenco", "screenshot", + "synopsis", "cmdsynopsis", "funcsynopsis", + "classsynopsis", "fieldsynopsis", "constructorsynopsis", + "destructorsynopsis", "methodsynopsis", "formalpara", + "para", "simpara", "address", "blockquote", + "graphic", "graphicco", "mediaobject", + "mediaobjectco", "informalequation", "informalexample", + "informalfigure", "informaltable", "equation", + "example", "figure", "table", "msgset", + "procedure", "sidebar", "qandaset", + "task", "productionset", "constraintdef", + "anchor", "bridgehead", "remark", + "highlights", "abstract", "authorblurb" + or "epigraph". + </p> + </td> +</tr> +</tbody> +</table></div> +<p> + For Quickbook users the file auto_index_helpers.qbk contains a helper template + that assists in inserting these processing instructions, for example: + </p> +<pre class="programlisting">[AutoIndex IgnoreSection]</pre> +<p> + Will cause that section to not be indexed. + </p> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="entries.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="build_docs.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/refine.html b/tools/auto_index/doc/html/boost_autoindex/tut/refine.html new file mode 100644 index 0000000000..3299dcb923 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/refine.html @@ -0,0 +1,99 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 8: Iterate - to refine your index</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="build_docs.html" title="Step 7: Build the Docs"> +<link rel="next" href="../script_ref.html" title="Script File (.idx) Reference"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="build_docs.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="../script_ref.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.refine"></a><a class="link" href="refine.html" title="Step 8: Iterate - to refine your index">Step 8: Iterate - to refine + your index</a> +</h3></div></div></div> +<p> + Creating a good index is an iterative process, often the first step is just + to add a header scanning rule to the script file and then generate the documentation + and see: + </p> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem"> + What's missing. + </li> +<li class="listitem"> + What's been included that shouldn't be. + </li> +<li class="listitem"> + What's been included under a poor name. + </li> +</ul></div> +<p> + Further rules can then be added to the script to handle these cases and the + next iteration examined, and so on. + </p> +<div class="tip"><table border="0" summary="Tip"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> +<th align="left">Tip</th> +</tr> +<tr><td align="left" valign="top"><p> + If you don't understand why a particular term is (or is not) present in + the index, try adding a <span class="emphasis"><em>!debug regular-expression</em></span> + directive to the <a class="link" href="../script_ref.html" title="Script File (.idx) Reference">script file</a>. + </p></td></tr> +</table></div> +<a name="boost_autoindex.tut.refine.restricting_which_sections_are_indexed_for_a_particular_term"></a><h5> +<a name="boost_autoindex.tut.refine.restricting_which_sections_are_indexed_for_a_particular_term-heading"></a> + <a class="link" href="refine.html#boost_autoindex.tut.refine.restricting_which_sections_are_indexed_for_a_particular_term">Restricting + which Sections are indexed for a particular term</a> + </h5> +<p> + You can restrict which sections are indexed for a particular term. So assuming + that the docbook document has the usual hierarchical names for section ID's + (as Quickbook generates, for example), you can easily place a constraint + on which sections are examined for a particular term. + </p> +<p> + For example, if you want to index occurrences of Lord Kelvin's name, but + only in the introduction section, you might then add: + </p> +<pre class="programlisting"><span class="identifier">Kelvin</span> <span class="string">""</span> <span class="string">".*introduction.*"</span> +</pre> +<p> + to the script file, assuming that the section ID of the intro is "some_library_or_chapter_name.introduction". + </p> +<p> + This would avoid an index entry every time 'Kelvin' is found, something the + user is unlikely to find helpful. + </p> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="build_docs.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="../script_ref.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/tut/script.html b/tools/auto_index/doc/html/boost_autoindex/tut/script.html new file mode 100644 index 0000000000..cd272f24f7 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/tut/script.html @@ -0,0 +1,160 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Step 4: Create the .idx script file - to control what to terms to index</title> +<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../tut.html" title="Getting Started and Tutorial"> +<link rel="prev" href="add_indexes.html" title="Step 3: Add indexes to your documentation"> +<link rel="next" href="entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> +<td align="center"><a href="../../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="add_indexes.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="entries.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boost_autoindex.tut.script"></a><a class="link" href="script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script + file - to control what to terms to index</a> +</h3></div></div></div> +<p> + AutoIndex works by reading a script file that tells it what terms to index. + </p> +<p> + If your document contains largely text, and only a small amount of simple + C++, and/or if you are using Doxygen to provide a C++ Reference section (that + lists the C++ elements), and/or if you are relying on the indexing provided + from a Standalone Doxygen Index, you may decide that a index is not needed + and that you may only want the text part indexed. + </p> +<p> + But if you want C++ classes functions, typedefs and/or macros AutoIndexed, + optionally, the script file also tells which other C++ files to scan. + </p> +<p> + At its simplest, it will scan one or more headers for terms that should be + indexed in the documentation. So for example to scan "myheader.hpp" + the script file would just contain: + </p> +<pre class="programlisting"><span class="special">!</span><span class="identifier">scan</span> <span class="identifier">myheader</span><span class="special">.</span><span class="identifier">hpp</span> +<span class="special">!</span><span class="identifier">scan</span> <span class="identifier">mydetailsheader</span><span class="special">.</span><span class="identifier">hpp</span> +</pre> +<p> + Or, more likely in practice, so we can recursively scan through directories + looking for all the files to scan whose <span class="bold"><strong>name matches + a particular regular expression</strong></span>: + </p> +<pre class="programlisting">!scan-path "boost/mylibrary" ".*.hpp" true </pre> +<p> + Each argument is whitespace separated and can be optionally enclosed in "double + quotes" (recommended). + </p> +<p> + The final <span class="emphasis"><em>true</em></span> argument indicates that subdirectories + in <code class="computeroutput"><span class="special">/</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">mylibrary</span></code> should be searched recursively + in addition to that directory. + </p> +<div class="caution"><table border="0" summary="Caution"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td> +<th align="left">Caution</th> +</tr> +<tr><td align="left" valign="top"><p> + The second <span class="emphasis"><em>file-name-regex</em></span> argument is a regular expression + and not a filename GLOB! + </p></td></tr> +</table></div> +<div class="caution"><table border="0" summary="Caution"> +<tr> +<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td> +<th align="left">Caution</th> +</tr> +<tr><td align="left" valign="top"><p> + The scan-path is modified by any setting of <auto-index-prefix>. + The examples here assume that this is <code class="literal"><auto-index-prefix>../../..</code> + so that <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mylibrary</span></code> will be your header files, + <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">mylibrary</span><span class="special">/</span><span class="identifier">doc</span></code> will contain your documentation files + and <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">mylibrary</span><span class="special">/</span><span class="identifier">example</span></code> will contain your examples. + </p></td></tr> +</table></div> +<p> + You could also scan any examples (.cpp) files, typically in folder <code class="computeroutput"><span class="special">/</span><span class="identifier">mylibrary</span><span class="special">/</span><span class="identifier">lib</span><span class="special">/</span><span class="identifier">example</span></code>. + </p> +<pre class="programlisting"># All example source files, assuming no sub-folders. +!scan-path "libs/mylibrary/example" ".*\.cpp" +</pre> +<p> + Often the <span class="emphasis"><em>scan</em></span> or <span class="emphasis"><em>scan-path</em></span> rules + will bring in too many terms to search for, so we need to be able to exclude + terms as well: + </p> +<pre class="programlisting"><span class="special">!</span><span class="identifier">exclude</span> <span class="identifier">type</span> +</pre> +<p> + Which excludes the term "type" from being indexed. + </p> +<p> + We can also add terms manually: + </p> +<pre class="programlisting"><span class="identifier">foobar</span> +</pre> +<p> + will index occurrences of "foobar" and: + </p> +<pre class="programlisting"><span class="identifier">foobar</span> <span class="special">\<\</span><span class="identifier">w</span><span class="special">*(</span><span class="identifier">foo</span><span class="special">|</span><span class="identifier">bar</span><span class="special">)\</span><span class="identifier">w</span><span class="special">*\></span> +</pre> +<p> + will index any whole word containing either "foo" or "bar" + within it, this is useful when you want to index a lot of similar or related + words under one entry, for example: + </p> +<pre class="programlisting"><span class="identifier">reflex</span> +</pre> +<p> + Will only index occurrences of "reflex" as a whole word, but: + </p> +<pre class="programlisting"><span class="identifier">reflex</span> <span class="special">\<</span><span class="identifier">reflex</span><span class="special">\</span><span class="identifier">w</span><span class="special">*\></span> +</pre> +<p> + will index occurrences of "reflex", "reflexing" and "reflexed" + all under the same entry <span class="emphasis"><em>reflex</em></span>. You will very often + need to use this to deal with plurals and other variants. + </p> +<p> + This inclusion rule can also restrict the term to certain sections, and add + an index category that the term should belong to (so it only appears in certain + indexes). + </p> +<p> + Finally the script can add rewrite rules, that rename section names that + are automatically used as index entries. For example we might want to remove + leading "A" or "The" prefixes from section titles when + AutoIndex uses them as an index entry: + </p> +<pre class="programlisting"><span class="special">!</span><span class="identifier">rewrite</span><span class="special">-</span><span class="identifier">name</span> <span class="string">"(?i)(?:A|The)\s+(.*)"</span> <span class="string">"\1"</span> +</pre> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="add_indexes.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="entries.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/workflow.html b/tools/auto_index/doc/html/boost_autoindex/workflow.html new file mode 100644 index 0000000000..6d08b2829b --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/workflow.html @@ -0,0 +1,90 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Understanding The AutoIndex Workflow</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="script_ref.html" title="Script File (.idx) Reference"> +<link rel="next" href="xml.html" title="XML Handling"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="script_ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="xml.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.workflow"></a><a class="link" href="workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a> +</h2></div></div></div> +<div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + Load the script file (usually index.idx) and process it one line at a time, + producing one or more index term per (non-comment) line. + </li> +<li class="listitem"> + Reading all lines builds a list of <span class="emphasis"><em>terms to index</em></span>. + Some of those may be terms defined (by you) directly in the script file, + others may be terms found by scanning C++ header and source files that + were specified by the <span class="emphasis"><em>!scan-path</em></span> directive. + </li> +<li class="listitem"> + Once the complete list of <span class="emphasis"><em>terms to index</em></span> is complete, + it loads the Docbook XML file. (If this comes from Quickbook/Doxygen/Boostbook/Docbook + then this is the complete documentation after conversion to Docbook format). + </li> +<li class="listitem"> + AutoIndex builds an internal <a href="http://en.wikipedia.org/wiki/Document_Object_Model" target="_top">Document + Object Model (DOM)</a> of the Docbook XML. This internal representation + then gets scanned for occurrences of the <span class="emphasis"><em>terms to index</em></span>. + This scanning works at the XML paragraph level (or equivalent sibling such + as a table or code block) - so all the XML encoding within a paragraph + gets flattened to plain text.<br> This flattening means the regular expressions + used to search for <span class="emphasis"><em>terms to index</em></span> can find anything + that is completely contained within a paragraph (or code block etc). + </li> +<li class="listitem"> + For each term found then an <span class="emphasis"><em>indexterm</em></span> Docbook element + is inserted into the <a href="http://en.wikipedia.org/wiki/Document_Object_Model" target="_top">Document + Object Model (DOM)</a> (provided internal index generation is off), + </li> +<li class="listitem"> + Also the AutoIndex's internal index representation gets updated. + </li> +<li class="listitem"> + Once the whole XML document has been indexed, then, if AutoIndex has been + instructed to generate the index itself, it creates the necessary XML and + inserts this into the <a href="http://en.wikipedia.org/wiki/Document_Object_Model" target="_top">Document + Object Model (DOM)</a>. + </li> +<li class="listitem"> + Finally the whole <a href="http://en.wikipedia.org/wiki/Document_Object_Model" target="_top">Document + Object Model (DOM)</a> is written out as a new Docbook XML file, and + normal processing of this continues via the XSL stylesheets (with xsltproc) + to actually build the final human-readable docs. + </li> +</ol></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="script_ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="xml.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boost_autoindex/xml.html b/tools/auto_index/doc/html/boost_autoindex/xml.html new file mode 100644 index 0000000000..aee7e6cfa3 --- /dev/null +++ b/tools/auto_index/doc/html/boost_autoindex/xml.html @@ -0,0 +1,65 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>XML Handling</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="workflow.html" title="Understanding The AutoIndex Workflow"> +<link rel="next" href="qbk.html" title="Quickbook Support"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="workflow.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="qbk.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boost_autoindex.xml"></a><a class="link" href="xml.html" title="XML Handling">XML Handling</a> +</h2></div></div></div> +<p> + AutoIndex is rather simplistic in its handling of XML: + </p> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem"> + When indexing a document, all block content at the paragraph level gets + collapsed into a single string for matching against the regular expressions + representing each index term. In other words, for the most part, you can + assume that you're indexing plain text when writing regular expressions. + </li> +<li class="listitem"> + Named XML entities for &, ", ', < or > are converted to + their corresponding characters before indexing a section of text. However, + decimal or hex escape sequences are not currently converted. + </li> +<li class="listitem"> + Index terms are assumed to be plain text (whether they originate from the + script file or from scanning source files) and the characters &, ", + < and > will be escaped to &amp; &quot; &lt; and &gt; + respectively. + </li> +</ul></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="workflow.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="qbk.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/boostbook.css b/tools/auto_index/doc/html/boostbook.css new file mode 100644 index 0000000000..252fa9ecfd --- /dev/null +++ b/tools/auto_index/doc/html/boostbook.css @@ -0,0 +1,588 @@ +/*============================================================================= + Copyright (c) 2004 Joel de Guzman + http://spirit.sourceforge.net/ + + Distributed under the Boost Software License, Version 1.0. (See accompany- + ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +/*============================================================================= + Body defaults +=============================================================================*/ + + body + { + margin: 1em; + font-family: sans-serif; + } + +/*============================================================================= + Paragraphs +=============================================================================*/ + + p + { + text-align: left; + font-size: 10pt; + line-height: 1.15; + } + +/*============================================================================= + Program listings +=============================================================================*/ + + /* Code on paragraphs */ + p tt.computeroutput + { + font-size: 9pt; + } + + pre.synopsis + { + font-size: 90%; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + .programlisting, + .screen + { + font-size: 9pt; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + /* Program listings in tables don't get borders */ + td .programlisting, + td .screen + { + margin: 0pc 0pc 0pc 0pc; + padding: 0pc 0pc 0pc 0pc; + } + +/*============================================================================= + Headings +=============================================================================*/ + + h1, h2, h3, h4, h5, h6 + { + text-align: left; + margin: 1em 0em 0.5em 0em; + font-weight: bold; + } + + h1 { font: 140% } + h2 { font: bold 140% } + h3 { font: bold 130% } + h4 { font: bold 120% } + h5 { font: italic 110% } + h6 { font: italic 100% } + + /* Top page titles */ + title, + h1.title, + h2.title + h3.title, + h4.title, + h5.title, + h6.title, + .refentrytitle + { + font-weight: bold; + margin-bottom: 1pc; + } + + h1.title { font-size: 140% } + h2.title { font-size: 140% } + h3.title { font-size: 130% } + h4.title { font-size: 120% } + h5.title { font-size: 110% } + h6.title { font-size: 100% } + + .section h1 + { + margin: 0em 0em 0.5em 0em; + font-size: 140%; + } + + .section h2 { font-size: 140% } + .section h3 { font-size: 130% } + .section h4 { font-size: 120% } + .section h5 { font-size: 110% } + .section h6 { font-size: 100% } + + /* Code on titles */ + h1 tt.computeroutput { font-size: 140% } + h2 tt.computeroutput { font-size: 140% } + h3 tt.computeroutput { font-size: 130% } + h4 tt.computeroutput { font-size: 120% } + h5 tt.computeroutput { font-size: 110% } + h6 tt.computeroutput { font-size: 100% } + +/*============================================================================= + Author +=============================================================================*/ + + h3.author + { + font-size: 100% + } + +/*============================================================================= + Lists +=============================================================================*/ + + li + { + font-size: 10pt; + line-height: 1.3; + } + + /* Unordered lists */ + ul + { + text-align: left; + } + + /* Ordered lists */ + ol + { + text-align: left; + } + +/*============================================================================= + Links +=============================================================================*/ + + a + { + text-decoration: none; /* no underline */ + } + + a:hover + { + text-decoration: underline; + } + +/*============================================================================= + Spirit style navigation +=============================================================================*/ + + .spirit-nav + { + text-align: right; + } + + .spirit-nav a + { + color: white; + padding-left: 0.5em; + } + + .spirit-nav img + { + border-width: 0px; + } + +/*============================================================================= + Copyright footer +=============================================================================*/ + .copyright-footer + { + text-align: right; + font-size: 70%; + } + + .copyright-footer p + { + text-align: right; + font-size: 80%; + } + +/*============================================================================= + Table of contents +=============================================================================*/ + + .toc + { + margin: 1pc 4% 0pc 4%; + padding: 0.1pc 1pc 0.1pc 1pc; + font-size: 80%; + line-height: 1.15; + } + + .boost-toc + { + float: right; + padding: 0.5pc; + } + +/*============================================================================= + Tables +=============================================================================*/ + + .table-title, + div.table p.title + { + margin-left: 4%; + padding-right: 0.5em; + padding-left: 0.5em; + } + + .informaltable table, + .table table + { + width: 92%; + margin-left: 4%; + margin-right: 4%; + } + + div.informaltable table, + div.table table + { + padding: 4px; + } + + /* Table Cells */ + div.informaltable table tr td, + div.table table tr td + { + padding: 0.5em; + text-align: left; + font-size: 9pt; + } + + div.informaltable table tr th, + div.table table tr th + { + padding: 0.5em 0.5em 0.5em 0.5em; + border: 1pt solid white; + font-size: 80%; + } + + table.simplelist + { + width: auto !important; + margin: 0em !important; + padding: 0em !important; + border: none !important; + } + table.simplelist td + { + margin: 0em !important; + padding: 0em !important; + text-align: left !important; + font-size: 9pt !important; + border: none !important; + } + +/*============================================================================= + Blurbs +=============================================================================*/ + + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + font-size: 9pt; /* A little bit smaller than the main text */ + line-height: 1.2; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + p.blurb img + { + padding: 1pt; + } + +/*============================================================================= + Variable Lists +=============================================================================*/ + + /* Make the terms in definition lists bold */ + div.variablelist dl dt, + span.term + { + font-weight: bold; + font-size: 10pt; + } + + div.variablelist table tbody tr td + { + text-align: left; + vertical-align: top; + padding: 0em 2em 0em 0em; + font-size: 10pt; + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + + div.variablelist dl dt + { + margin-bottom: 0.2em; + } + + div.variablelist dl dd + { + margin: 0em 0em 0.5em 2em; + font-size: 10pt; + } + + div.variablelist table tbody tr td p, + div.variablelist dl dd p + { + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + +/*============================================================================= + Misc +=============================================================================*/ + + /* Title of books and articles in bibliographies */ + span.title + { + font-style: italic; + } + + span.underline + { + text-decoration: underline; + } + + span.strikethrough + { + text-decoration: line-through; + } + + /* Copyright, Legal Notice */ + div div.legalnotice p + { + text-align: left + } + +/*============================================================================= + Colors +=============================================================================*/ + + @media screen + { + body { + background-color: #FFFFFF; + } + + /* Links */ + a + { + color: #005a9c; + } + + a:visited + { + color: #9c5a9c; + } + + h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, + h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, + h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited + { + text-decoration: none; /* no underline */ + color: #000000; + } + + /* Syntax Highlighting */ + .keyword { color: #0000AA; } + .identifier { color: #000000; } + .special { color: #707070; } + .preprocessor { color: #402080; } + .char { color: teal; } + .comment { color: #800000; } + .string { color: teal; } + .number { color: teal; } + .white_bkd { background-color: #FFFFFF; } + .dk_grey_bkd { background-color: #999999; } + + /* Copyright, Legal Notice */ + .copyright + { + color: #666666; + font-size: small; + } + + div div.legalnotice p + { + color: #666666; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid #DCDCDC; + } + + .programlisting, + .screen + { + border: 1px solid #DCDCDC; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Blurbs */ + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + border: 1px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid #DCDCDC; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid #DCDCDC; + } + + div.informaltable table tr th, + div.table table tr th + { + background-color: #F0F0F0; + border: 1px solid #DCDCDC; + } + + .copyright-footer + { + color: #8F8F8F; + } + + /* Misc */ + span.highlight + { + color: #00A000; + } + } + + @media print + { + /* Links */ + a + { + color: black; + } + + a:visited + { + color: black; + } + + .spirit-nav + { + display: none; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid gray; + } + + .programlisting, + .screen + { + border: 1px solid gray; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid gray; + } + + .informaltable table, + .table table + { + border: 1px solid gray; + border-collapse: collapse; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid gray; + } + + div.informaltable table tr th, + div.table table tr th + { + border: 1px solid gray; + } + + table.simplelist tr td + { + border: none !important; + } + + /* Misc */ + span.highlight + { + font-weight: bold; + } + } + +/*============================================================================= + Images +=============================================================================*/ + + span.inlinemediaobject img + { + vertical-align: middle; + } + +/*============================================================================== + Super and Subscript: style so that line spacing isn't effected, see + http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341 +==============================================================================*/ + +sup, +sub { + height: 0; + line-height: 1; + vertical-align: baseline; + _vertical-align: bottom; + position: relative; + +} + +sup { + bottom: 1ex; +} + +sub { + top: .5ex; +} + diff --git a/tools/auto_index/doc/html/images/blank.png b/tools/auto_index/doc/html/images/blank.png Binary files differnew file mode 100644 index 0000000000..764bf4f0c3 --- /dev/null +++ b/tools/auto_index/doc/html/images/blank.png diff --git a/tools/auto_index/doc/html/images/caution.png b/tools/auto_index/doc/html/images/caution.png Binary files differnew file mode 100644 index 0000000000..5b7809ca4a --- /dev/null +++ b/tools/auto_index/doc/html/images/caution.png diff --git a/tools/auto_index/doc/html/images/caution.svg b/tools/auto_index/doc/html/images/caution.svg new file mode 100644 index 0000000000..4bd586a08e --- /dev/null +++ b/tools/auto_index/doc/html/images/caution.svg @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --><svg height="120.648" id="Layer_1" inkscape:version="0.42" sodipodi:docbase="F:\openclip\svg da inviare" sodipodi:docname="Attenzione.svg" sodipodi:version="0.32" space="preserve" style="overflow:visible;enable-background:new 0 0 133.878 120.648;" version="1.1" viewBox="0 0 133.878 120.648" width="133.878" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"> + <metadata> + <rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <cc:Work rdf:about=""> + <dc:title>Attenzione</dc:title> + <dc:description></dc:description> + <dc:subject> + <rdf:Bag> + <rdf:li>pulsante</rdf:li> + </rdf:Bag> + </dc:subject> + <dc:publisher> + <cc:Agent rdf:about="http://www.openclipart.org/"> + <dc:title>Open Clip Art Library</dc:title> + </cc:Agent> + </dc:publisher> + <dc:creator> + <cc:Agent> + <dc:title>Architetto Francesco Rollandin</dc:title> + </cc:Agent> + </dc:creator> + <dc:rights> + <cc:Agent> + <dc:title>Architetto Francesco Rollandin</dc:title> + </cc:Agent> + </dc:rights> + <dc:date></dc:date> + <dc:format>image/svg+xml</dc:format> + <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> + <cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> + <dc:language>en</dc:language> + </cc:Work> + <cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> + <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> + <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> + <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> + </cc:License> + </rdf:RDF> + </metadata> + <defs id="defs43"/> + <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="Layer_1" inkscape:cx="66.939003" inkscape:cy="60.324001" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="510" inkscape:window-width="787" inkscape:window-x="44" inkscape:window-y="58" inkscape:zoom="2.9838869" pagecolor="#ffffff"/> + <g id="g3"> + <linearGradient gradientTransform="matrix(56.9977 90.4964 90.4964 -56.9977 -27343.9609 47971.0547)" gradientUnits="userSpaceOnUse" id="XMLID_4_" x1="-244.5732" x2="-242.8169" y1="455.4199" y2="455.4199"> + <stop id="stop6" offset="0" style="stop-color:#FFFA5F"/> + <stop id="stop8" offset="1" style="stop-color:#9F3300"/> + </linearGradient> + <path d="M51.333,8.834C34.985,37.343,18.638,65.854,2.289,94.363 c-7.081,12.352,3.352,26.285,16.453,26.285c6.708,0,13.418,0,20.128,0c22.109,0,44.217,0,66.327,0c3.644,0,7.286,0,10.931,0 c13.293,0,20.963-14.273,16.452-26.031c-4.114-10.729-11.861-20.99-17.542-30.922c-8.81-15.403-17.618-30.809-26.429-46.212 c-1.813-3.167-3.622-6.333-5.434-9.5C76.601-3.516,57.616-2.03,51.333,8.834 M53.973,9.064" id="path10" style="fill:url(#XMLID_4_);"/> + <path d="M55.474,12.388c-8.247,14.279-16.492,28.559-24.739,42.839 c-5.526,9.567-11.05,19.137-16.577,28.707c-2.732,4.73-7.323,10.456-8.284,16c-3.799,21.9,34.927,15.743,46.734,15.743 c20.073,0,40.144,0,60.215,0c13.716,0,18.636-11.963,12.229-23.063c-6.462-11.195-12.927-22.388-19.389-33.582 c-7.249-12.557-14.499-25.113-21.75-37.671c-1.682-2.916-3.364-5.829-5.049-8.745C73.767,3.785,60.676,3.364,55.474,12.388" id="path12" style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFF200;"/> + <path d="M55.474,12.388c-8.247,14.279-16.492,28.559-24.739,42.839c-5.526,9.567-11.05,19.137-16.577,28.707 c-2.732,4.73-7.323,10.456-8.284,16c-3.799,21.9,34.927,15.743,46.734,15.743c20.073,0,40.144,0,60.215,0 c13.716,0,18.636-11.963,12.229-23.063c-6.462-11.195-12.927-22.388-19.389-33.582c-7.249-12.557-14.499-25.113-21.75-37.671 c-1.682-2.916-3.364-5.829-5.049-8.745C73.767,3.785,60.676,3.364,55.474,12.388" id="path14" style="fill:#FFCE00;"/> + <path d="M126.731,95.522c-8.733-15.127-17.468-30.253-26.201-45.379 c-5.537-9.595-11.078-19.188-16.616-28.781c-3.938-6.821-7.459-15.689-16.813-15.689c1.013,0,5.901,10.225,6.469,11.196 c5.451,9.314,10.902,18.63,16.352,27.947c9.217,15.749,18.433,31.498,27.646,47.249c2.302,3.933,5.356,10.555,1.308,14.397 c-3.148,2.987-7.99,3.196-12.099,3.196c-7.225,0-14.448,0-21.674,0c-22.125,0-44.251,0-66.377,0c-3.598,0-7.197,0-10.794,0 c5.285,7.909,16.341,6.02,24.546,6.02c13.009,0,26.017,0,39.023,0c11.979,0,23.958,0,35.937,0c2.516,0,5.032,0,7.547,0 C125.136,115.678,131.878,104.435,126.731,95.522" id="path16" style="fill:#FFB600;"/> + <path d="M14.615,112.457c-4.483-7.751,1.908-16.103,5.793-22.834 c4.698-8.138,9.398-16.276,14.097-24.414C44.54,47.83,54.574,30.448,64.61,13.069c0.789-1.367,3.725-4.568,2.594-5.539 c-3.913-3.353-10.287,1.936-12.107,5.087c-3.129,5.417-6.258,10.835-9.386,16.252c-11.105,19.226-22.209,38.453-33.313,57.68 c-1.649,2.854-3.299,5.713-4.95,8.569c-4.771,8.265-0.075,19.162,9.658,20.446C16.124,114.65,15.294,113.615,14.615,112.457" id="path18" style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFE600;"/> + <path d="M77.076,34.654c0,10.183-1.788,20.758-3.439,30.772 c-0.369,2.239-4.03,23.609-7.796,14.179c-4.247-10.632-4.832-23.419-5.958-34.696c-0.363-3.638-1.538-8.425-0.563-12.06 C61.667,24.099,77.076,25.199,77.076,34.654" id="path20" style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFE1;"/> + <path d="M77.076,34.654c-2.018,0.995-1.521,8.717-1.797,11.395c-0.685,6.643-1.505,13.282-2.614,19.869 c-0.79,4.701-1.301,10.862-3.954,14.981c-1.642,2.567-3.405-5.958-3.634-6.932c-2.948-12.443-4.464-25.664-5.09-38.43 c-0.272-5.52,5.164-8.854,10.277-7.622c3.87,0.933,5.217,7.36,7.688,6.738c0.009-11.451-19.755-11.453-19.746,0 c0.017,11.956,2.087,24.599,4.423,36.294c0.501,2.507,1.642,12.376,5.449,12.376c4.059-0.021,5.285-11.432,5.79-14.137 c1.261-6.765,2.139-13.605,2.887-20.444C77.084,45.722,79.281,35.942,77.076,34.654" id="path22" style="fill:#FFFFFF;"/> + <linearGradient gradientTransform="matrix(68.2284 33.0019 33.0019 -68.2284 1613.9791 39385.6641)" gradientUnits="userSpaceOnUse" id="XMLID_5_" x1="-246.981" x2="-245.2275" y1="458.29" y2="458.29"> + <stop id="stop25" offset="0" style="stop-color:#FFFA5F"/> + <stop id="stop27" offset="1" style="stop-color:#9F3300"/> + </linearGradient> + <path d="M57.957,34.654c0,10.053,1.632,20.54,3.242,30.431 c0.479,2.936,4.912,26.502,9.99,15.164c4.987-11.134,5.351-25.201,6.386-37.184c0.273-3.169,1.153-7.045,0.421-10.221 C75.628,22.587,57.957,23.788,57.957,34.654 M60.207,34.654c0-8.061,13.138-9.015,15.459-1.792c1.156,3.597-0.13,8.748-0.508,12.38 c-1.135,10.904-2.052,22.602-5.501,33.069c-2.816,8.545-5.546-10.187-5.934-12.522C62.039,55.63,60.207,44.985,60.207,34.654" id="path29" style="fill-rule:evenodd;clip-rule:evenodd;fill:url(#XMLID_5_);"/> + <path d="M77.076,96.788c0,11.964-18.555,11.964-18.555,0 C58.521,84.822,77.076,84.822,77.076,96.788" id="path31" style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFE1;"/> + <path d="M77.076,96.788c-2.605,1.661-2.157,6.757-7.044,8.101c-6.178,1.7-12.033-4.159-10.336-10.335 c1.439-5.23,7.657-7.767,12.341-5.021c2.91,1.704,3.164,7.913,5.915,7.256c0-14.267-22.698-12.238-20.143,1.826 c0.987,5.444,6.375,9.15,11.814,8.162C72.417,106.271,81.44,98.19,77.076,96.788" id="path33" style="fill:#FFFFFF;"/> + <linearGradient gradientTransform="matrix(68.2241 32.9998 32.9998 -68.2241 1604.682 39402.625)" gradientUnits="userSpaceOnUse" id="XMLID_6_" x1="-246.998" x2="-245.2348" y1="458.0625" y2="458.0625"> + <stop id="stop36" offset="0" style="stop-color:#FFFA5F"/> + <stop id="stop38" offset="1" style="stop-color:#9F3300"/> + </linearGradient> + <path d="M57.395,96.788c0,13.41,20.805,13.41,20.805,0 C78.2,83.376,57.395,83.375,57.395,96.788 M59.647,96.788c0-10.514,16.301-10.514,16.301,0 C75.948,107.3,59.647,107.3,59.647,96.788" id="path40" style="fill-rule:evenodd;clip-rule:evenodd;fill:url(#XMLID_6_);"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/draft.png b/tools/auto_index/doc/html/images/draft.png Binary files differnew file mode 100644 index 0000000000..0084708c9b --- /dev/null +++ b/tools/auto_index/doc/html/images/draft.png diff --git a/tools/auto_index/doc/html/images/home.png b/tools/auto_index/doc/html/images/home.png Binary files differnew file mode 100644 index 0000000000..5584aacb09 --- /dev/null +++ b/tools/auto_index/doc/html/images/home.png diff --git a/tools/auto_index/doc/html/images/home.svg b/tools/auto_index/doc/html/images/home.svg new file mode 100644 index 0000000000..e803a3178f --- /dev/null +++ b/tools/auto_index/doc/html/images/home.svg @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill-rule:nonzero;clip-rule:nonzero;fill:#FFFFFF;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st1 "fill:none;stroke:none;"> + <!ENTITY st2 "fill:#000000;"> + <!ENTITY st3 "fill:none;stroke:#FFFFFF;stroke-width:6.3469;stroke-linejoin:round;"> + <!ENTITY st4 "fill-rule:evenodd;clip-rule:evenodd;stroke:none;"> + <!ENTITY st5 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_3" style="&st0;"> + <g style="&st4;"> + <path style="&st3;" d="M22.9,7.1L5.1,21.8l0,0c-0.3,0.3-0.5,0.8-0.5,1.2c0,0.2,0,0.4,0.1,0.6c0.3,0.6,0.9,1,1.6,1c0,0,1.1,0,2.2,0c0,2.4,0,14.2,0,14.2c0,1.1,0.8,1.9,1.8,1.9h27.4c1.1,0,1.9-0.9,1.9-2c0,0,0-11.8,0-14.2c1,0,2,0,2,0c0.8,0,1.4-0.5,1.7-1.2 + c0.1-0.2,0.1-0.4,0.1-0.6c0-0.5-0.2-1-0.7-1.4c0,0-3.6-3-4.5-3.7c0-1.2,0-6.9,0-6.9c0-1.2-0.8-2-2-2h-4.8c-1,0-1.7,0.6-1.9,1.5c-1.9-1.6-4.1-3.5-4.1-3.5l0.1,0.1c-0.7-0.7-1.8-0.8-2.7-0.1z"/> + <path style="&st2;" d="M22.9,7.1L5.1,21.8l0,0c-0.3,0.3-0.5,0.8-0.5,1.2c0,0.2,0,0.4,0.1,0.6c0.3,0.6,0.9,1,1.6,1c0,0,1.1,0,2.2,0c0,2.4,0,14.2,0,14.2c0,1.1,0.8,1.9,1.8,1.9h27.4c1.1,0,1.9-0.9,1.9-2c0,0,0-11.8,0-14.2c1,0,2,0,2,0c0.8,0,1.4-0.5,1.7-1.2 + c0.1-0.2,0.1-0.4,0.1-0.6c0-0.5-0.2-1-0.7-1.4c0,0-3.6-3-4.5-3.7c0-1.2,0-6.9,0-6.9c0-1.2-0.8-2-2-2h-4.8c-1,0-1.7,0.6-1.9,1.5c-1.9-1.6-4.1-3.5-4.1-3.5l0.1,0.1c-0.7-0.7-1.8-0.8-2.7-0.1z"/> + <path style="&st2;" d="M41.8,22.8l-5.1-4.2v-0.1L31,13.7v0l-6.5-5.5C24.2,8,24,8,23.8,8.2L6.2,22.9c-0.1,0.1-0.1,0.3,0.1,0.3h1.6H10h28.1h1.2h2.3c0.2,0,0.4-0.2,0.2-0.4z"/> + <path d="M35.8,16.8l0-5.1c0-0.2-0.1-0.4-0.3-0.4h-3.2c-0.2,0-0.3,0.1-0.3,0.3v2.2l3.9,2.9z"/> + <path d="M11.9,24.7V37c0,0.3,0.1,0.4,0.3,0.4h23.6c0.3,0,0.4-0.2,0.4-0.4V24.7H11.9z"/> + </g> + </g> + <g id="crop_x0020_marks" style="&st5;"> + <path style="&st1;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/important.png b/tools/auto_index/doc/html/images/important.png Binary files differnew file mode 100644 index 0000000000..12c90f607a --- /dev/null +++ b/tools/auto_index/doc/html/images/important.png diff --git a/tools/auto_index/doc/html/images/important.svg b/tools/auto_index/doc/html/images/important.svg new file mode 100644 index 0000000000..dd84f3fe36 --- /dev/null +++ b/tools/auto_index/doc/html/images/important.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:#FFFFFF;stroke:none;"> + <!ENTITY st1 "fill:#FFFFFF;stroke-width:6.6112;stroke-linecap:round;stroke-linejoin:round;"> + <!ENTITY st2 "stroke:#FFFFFF;stroke-width:6.6112;"> + <!ENTITY st3 "fill:none;stroke:none;"> + <!ENTITY st4 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st5 "stroke:none;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_3" style="&st4;"> + <g> + <path style="&st2;" d="M41.7,35.3L26.6,9.4c-0.6-1-1.7-1.7-2.9-1.6c-1.2,0-2.3,0.7-2.9,1.7L6.3,35.4c-0.6,1-0.6,2.3,0,3.3c0.6,1,1.7,1.6,2.9,1.6h29.6c1.2,0,2.3-0.6,2.9-1.7c0.6-1,0.6-2.3,0-3.3z"/> + <path style="&st1;" d="M23.7,11L9.2,37h29.6L23.7,11z"/> + <path style="&st0;" d="M23.7,11.9L10.3,36.1h27.5l-14-24.1z"/> + <g> + <path style="&st5;" d="M24.1,34c-1.1,0-1.8-0.8-1.8-1.8c0-1.1,0.7-1.8,1.8-1.8c1.1,0,1.8,0.7,1.8,1.8c0,1-0.7,1.8-1.8,1.8h0z M22.9,29.3l-0.4-9.1h3.2l-0.4,9.1h-2.3z"/> + </g> + </g> + </g> + <g id="crop_x0020_marks" style="&st4;"> + <path style="&st3;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/next.png b/tools/auto_index/doc/html/images/next.png Binary files differnew file mode 100644 index 0000000000..59800b4e87 --- /dev/null +++ b/tools/auto_index/doc/html/images/next.png diff --git a/tools/auto_index/doc/html/images/next.svg b/tools/auto_index/doc/html/images/next.svg new file mode 100644 index 0000000000..75fa83ed8c --- /dev/null +++ b/tools/auto_index/doc/html/images/next.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:none;stroke:none;"> + <!ENTITY st1 "fill:#FFFFFF;stroke:#FFFFFF;stroke-width:7.5901;stroke-linejoin:round;"> + <!ENTITY st2 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st3 "stroke:none;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_3" style="&st2;"> + <g> + <path style="&st1;" d="M22.4,41.1c0,0.3,0.3,0.3,0.5,0.2l16.6-16.9c0.5-0.5,0.4-0.7,0-1L22.9,6.7c-0.1-0.1-0.4-0.1-0.4,0.1v10H8.9c-0.3,0-0.5,0.2-0.5,0.4l0,13.3C8.4,30.9,8.6,31,9,31h13.5l-0.1,10.1z"/> + <path style="&st3;" d="M22.4,41.1c0,0.3,0.3,0.3,0.5,0.2l16.6-16.9c0.5-0.5,0.4-0.7,0-1L22.9,6.7c-0.1-0.1-0.4-0.1-0.4,0.1v10H8.9c-0.3,0-0.5,0.2-0.5,0.4l0,13.3C8.4,30.9,8.6,31,9,31h13.5l-0.1,10.1z"/> + </g> + </g> + <g id="crop_x0020_marks" style="&st2;"> + <path style="&st0;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/next_disabled.png b/tools/auto_index/doc/html/images/next_disabled.png Binary files differnew file mode 100644 index 0000000000..10a8c59d7b --- /dev/null +++ b/tools/auto_index/doc/html/images/next_disabled.png diff --git a/tools/auto_index/doc/html/images/note.png b/tools/auto_index/doc/html/images/note.png Binary files differnew file mode 100644 index 0000000000..d0c3c645ab --- /dev/null +++ b/tools/auto_index/doc/html/images/note.png diff --git a/tools/auto_index/doc/html/images/note.svg b/tools/auto_index/doc/html/images/note.svg new file mode 100644 index 0000000000..648299d26f --- /dev/null +++ b/tools/auto_index/doc/html/images/note.svg @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:none;stroke:#FFFFFF;stroke-width:12.1438;stroke-linejoin:round;"> + <!ENTITY st1 "fill:none;stroke-width:1.2429;"> + <!ENTITY st2 "fill:#FFFFFF;stroke:none;"> + <!ENTITY st3 "fill:none;stroke:#FFFFFF;stroke-width:12.7649;stroke-linejoin:round;"> + <!ENTITY st4 "fill:#FFFFFF;stroke-width:6.3824;stroke-linejoin:round;"> + <!ENTITY st5 "fill:none;stroke:none;"> + <!ENTITY st6 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st7 "fill:#FFFFFF;stroke:#FFFFFF;stroke-width:12.7649;stroke-linejoin:round;"> + <!ENTITY st8 "stroke:none;"> + <!ENTITY st9 "fill:none;stroke-width:4.9715;stroke-linejoin:round;"> +]> +<svg xmlns="http://www.w3.org/2000/svg" width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve"> + <g id="Layer_x0020_1" style="&st6;"> + <path style="&st0;" d="M35.7,19.8v18.9H11V8.8h13.9l10.8,11z"/> + <path style="&st3;" d="M38.7,30.4L25,16.7l-7.7-3l2.7,8.7l13.3,13.4l5.4-5.4z"/> + <path style="&st7;" d="M35.7,8.8H11v29.9h24.7V8.8z"/> + <path style="&st4;" d="M35.7,8.8H11v29.9h24.7V8.8z"/> + <path style="&st2;" d="M35.7,8.8H11v29.9h24.7V8.8z"/> + </g> + <g id="Layer_x0020_4" style="&st6;"> + <path style="&st9;" d="M38.7,30.4L25,16.7l-7.7-3l2.7,8.7l13.3,13.4l5.4-5.4z"/> + <path style="&st8;" d="M38.7,30.4L25,16.7l-7.7-3l2.7,8.7l13.3,13.4l5.4-5.4z"/> + <path style="&st8;" d="M20.6,14.7l-2.5,2.5L17,13.4l3.6,1.3z"/> + <path style="&st1;" d="M19.6,22.2l3-0.3l2.4-2.4l0.4-2.8"/> + <path style="&st2;" d="M20.4,14.9L18.3,17l1.6,5.2l2.7-0.3l2.4-2.4l0.3-2.4l-5-2.2z"/> + </g> + <g id="crop" style="&st6;"> + <path style="&st5;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/prev.png b/tools/auto_index/doc/html/images/prev.png Binary files differnew file mode 100644 index 0000000000..d88a40f923 --- /dev/null +++ b/tools/auto_index/doc/html/images/prev.png diff --git a/tools/auto_index/doc/html/images/prev.svg b/tools/auto_index/doc/html/images/prev.svg new file mode 100644 index 0000000000..6d88ffdd0d --- /dev/null +++ b/tools/auto_index/doc/html/images/prev.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:none;stroke:none;"> + <!ENTITY st1 "fill:#FFFFFF;stroke:#FFFFFF;stroke-width:7.5901;stroke-linejoin:round;"> + <!ENTITY st2 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st3 "stroke:none;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_3" style="&st2;"> + <g> + <path style="&st1;" d="M25.6,6.9c0-0.3-0.3-0.3-0.5-0.2L8.4,23.6c-0.5,0.5-0.4,0.7,0,1l16.6,16.6c0.1,0.1,0.4,0.1,0.4-0.1v-10h13.6c0.3,0,0.5-0.2,0.5-0.4l0-13.3c0-0.3-0.2-0.5-0.5-0.5H25.5l0.1-10.1z"/> + <path style="&st3;" d="M25.6,6.9c0-0.3-0.3-0.3-0.5-0.2L8.4,23.6c-0.5,0.5-0.4,0.7,0,1l16.6,16.6c0.1,0.1,0.4,0.1,0.4-0.1v-10h13.6c0.3,0,0.5-0.2,0.5-0.4l0-13.3c0-0.3-0.2-0.5-0.5-0.5H25.5l0.1-10.1z"/> + </g> + </g> + <g id="crop_x0020_marks" style="&st2;"> + <path style="&st0;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/prev_disabled.png b/tools/auto_index/doc/html/images/prev_disabled.png Binary files differnew file mode 100644 index 0000000000..ab3c17e02d --- /dev/null +++ b/tools/auto_index/doc/html/images/prev_disabled.png diff --git a/tools/auto_index/doc/html/images/tip.png b/tools/auto_index/doc/html/images/tip.png Binary files differnew file mode 100644 index 0000000000..5c4aab3bb3 --- /dev/null +++ b/tools/auto_index/doc/html/images/tip.png diff --git a/tools/auto_index/doc/html/images/tip.svg b/tools/auto_index/doc/html/images/tip.svg new file mode 100644 index 0000000000..cd437a5e85 --- /dev/null +++ b/tools/auto_index/doc/html/images/tip.svg @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --><svg height="1052.3622047" id="svg2" inkscape:version="0.42.2" sodipodi:docbase="/home/sergio/tmp/downloads" sodipodi:docname="lamp.svg" sodipodi:version="0.32" width="744.09448819" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <metadata> + <rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <cc:Work rdf:about=""> + <dc:title>lamp</dc:title> + <dc:description></dc:description> + <dc:subject> + <rdf:Bag> + <rdf:li>office</rdf:li> + <rdf:li></rdf:li> + <rdf:li>lamp</rdf:li> + </rdf:Bag> + </dc:subject> + <dc:publisher> + <cc:Agent rdf:about="http://www.openclipart.org/"> + <dc:title>Open Clip Art Library</dc:title> + </cc:Agent> + </dc:publisher> + <dc:creator> + <cc:Agent> + <dc:title>Sergio Luiz Araujo Silva</dc:title> + </cc:Agent> + </dc:creator> + <dc:rights> + <cc:Agent> + <dc:title>Public Domain</dc:title> + </cc:Agent> + </dc:rights> + <dc:date>set 2005</dc:date> + <dc:format>image/svg+xml</dc:format> + <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> + <cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> + <dc:language>en</dc:language> + </cc:Work> + <cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> + <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> + <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> + <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> + </cc:License> + </rdf:RDF> + </metadata> + <defs id="defs4"> + <linearGradient id="linearGradient13125"> + <stop id="stop13127" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/> + <stop id="stop13129" offset="1" style="stop-color:#fffeff;stop-opacity:0;"/> + </linearGradient> + <linearGradient id="linearGradient12389"> + <stop id="stop12391" offset="0.0000000" style="stop-color:#fefefe;stop-opacity:1.0000000;"/> + <stop id="stop12393" offset="1.0000000" style="stop-color:#fffefe;stop-opacity:1.0000000;"/> + </linearGradient> + <radialGradient cx="358.25909" cy="186.06468" fx="358.25909" fy="186.06468" gradientTransform="matrix(1.000001,-8.244061e-7,3.143917e-7,0.381356,-4.028738e-4,115.1081)" gradientUnits="userSpaceOnUse" id="radialGradient13131" inkscape:collect="always" r="27.486719" xlink:href="#linearGradient13125"/> + <radialGradient cx="358.25909" cy="186.06468" fx="358.25909" fy="186.06468" gradientTransform="matrix(1.000001,-8.244061e-7,3.143917e-7,0.381356,-4.028738e-4,115.1081)" gradientUnits="userSpaceOnUse" id="radialGradient14587" inkscape:collect="always" r="27.486719" xlink:href="#linearGradient13125"/> + <radialGradient cx="358.25909" cy="186.06468" fx="358.25909" fy="186.06468" gradientTransform="matrix(1.000001,-8.244061e-7,3.143917e-7,0.381356,-4.028738e-4,115.1081)" gradientUnits="userSpaceOnUse" id="radialGradient15390" inkscape:collect="always" r="27.486719" xlink:href="#linearGradient13125"/> + <radialGradient cx="358.25909" cy="186.06468" fx="358.25909" fy="186.06468" gradientTransform="matrix(1.000001,-8.244061e-7,3.143917e-7,0.381356,-4.028738e-4,115.1081)" gradientUnits="userSpaceOnUse" id="radialGradient16141" inkscape:collect="always" r="27.486719" xlink:href="#linearGradient13125"/> + </defs> + <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="344.34505" inkscape:cy="795.78292" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="693" inkscape:window-width="1024" inkscape:window-x="0" inkscape:window-y="25" inkscape:zoom="0.72123084" pagecolor="#ffffff" showguides="true"/> + <g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1"> + <path d="M 369.44028,121.86683 C 302.64703,119.68096 242.59223,184.30679 250.47188,250.87980 C 252.47522,280.21980 267.84094,306.49880 285.94332,328.82253 C 303.71281,358.65039 312.13900,393.24133 313.51068,427.73030 C 317.00419,446.97288 338.01608,454.57063 355.35334,455.26572 C 375.18456,456.91501 395.94281,455.09265 414.43470,447.69729 C 430.92724,435.70557 427.37713,413.20597 430.74488,395.55648 C 434.70351,361.57615 449.78002,329.76555 471.07843,303.26619 C 504.41026,252.31528 488.56419,176.76397 437.75400,143.26422 C 417.82956,129.49394 393.70573,121.69096 369.44028,121.86683 z " id="path1384" style="opacity:1.0000000;fill:#f3f2f3;fill-opacity:0.83333331;stroke:#000000;stroke-width:0.58960420;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"/> + <path d="M 425.72698,154.07768 C 437.68158,164.87540 453.68534,182.03604 451.17873,203.82428 C 455.99913,200.54641 460.81954,197.26853 465.63995,193.99066 C 459.85546,170.27425 448.28648,162.75442 425.72698,154.07768 z " id="path2153" sodipodi:nodetypes="cccc" style="fill:#fefefe;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 506.99897 296.94009 A 37.120701 18.718985 0 1 1 432.75756,296.94009 A 37.120701 18.718985 0 1 1 506.99897 296.94009 z" id="path2881" sodipodi:cx="469.87827" sodipodi:cy="296.94009" sodipodi:rx="37.120701" sodipodi:ry="18.718985" sodipodi:type="arc" style="opacity:1.0000000;color:#000000;fill:#fefefe;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:0.64700001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" transform="matrix(0.818103,0.000000,0.000000,0.896150,-13.89510,-26.68653)"/> + <path d="M 359.20536,314.30802 L 336.64585,244.31570 C 362.29042,230.62575 382.72895,234.28926 403.16748,243.15881 L 379.45107,315.46491 L 379.45107,315.46491" id="path3617" sodipodi:nodetypes="ccccc" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#8f9595;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 513.73605 514.32300 A 52.508934 11.885468 0 1 1 408.71818,514.32300 A 52.508934 11.885468 0 1 1 513.73605 514.32300 z" id="path4361" sodipodi:cx="461.22711" sodipodi:cy="514.32300" sodipodi:rx="52.508934" sodipodi:ry="11.885468" sodipodi:type="arc" style="opacity:1.0000000;color:#000000;fill:#a0a0a0;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:0.64700001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" transform="matrix(0.982435,0.000000,0.000000,1.387810,-83.52495,-281.2705)"/> + <path d="M 315.87677,433.07959 C 319.14672,442.90428 329.03398,448.82383 338.76816,450.68840 C 362.00206,456.37952 386.74882,455.38004 409.63484,448.57985 C 414.28840,447.19363 419.18392,445.42184 422.06530,441.25295 C 423.42527,439.84003 425.68582,434.46169 424.07088,434.30126 C 411.81432,444.17256 395.75685,447.78808 380.34111,448.56322 C 362.85475,449.05661 344.64886,448.26521 328.51659,440.79114 C 324.02706,438.71576 319.76022,436.14612 315.87677,433.07959 z " id="path4363" style="fill:#d6dee6;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 400.47436,522.16227 C 396.48542,528.09177 392.49650,534.02126 388.50756,539.95076 C 383.93367,541.47295 366.98819,546.44954 353.57745,538.01018 C 350.34318,532.29631 347.10892,526.58244 343.87465,520.86856 C 364.35835,531.64946 396.48542,523.99502 400.47436,522.16227 z " id="path5094" sodipodi:nodetypes="ccccc" style="fill:#090a0c;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 419.65600,444.27781 C 419.97026,446.39906 420.28452,448.52031 420.59878,450.64156 C 421.46299,450.95582 422.32720,451.27008 423.19142,451.58434 C 423.19142,452.91994 423.19142,454.25554 423.19142,455.59114 C 422.32720,455.98397 421.46299,456.37678 420.59878,456.76961 C 420.36308,459.20512 420.12739,461.64063 419.89170,464.07614 C 420.52021,464.23327 421.14873,464.39039 421.77725,464.54753 C 421.69869,466.59021 421.62012,468.63289 421.54156,470.67558 C 420.83447,471.46123 420.12739,472.24688 419.42030,473.03253 C 419.57744,474.05387 419.73456,475.07522 419.89170,476.09656 C 420.91303,477.11790 421.93438,478.13925 422.95572,479.16058 C 422.87716,480.18193 422.79859,481.20328 422.72003,482.22461 C 422.01294,483.01026 421.30586,483.79591 420.59878,484.58156 C 420.36308,485.05294 420.12739,485.52433 419.89170,485.99572 C 419.57744,486.70280 419.26317,487.40989 418.94892,488.11697 C 419.10605,489.05975 419.26317,490.00253 419.42030,490.94531 C 419.89170,491.65239 420.36308,492.35947 420.83447,493.06655 C 420.67734,494.71641 420.52021,496.36627 420.36308,498.01614 C 415.02067,505.24410 409.67827,512.47206 404.33587,519.70003 C 403.15740,520.24998 401.97892,520.79994 400.80045,521.34989 C 397.81498,522.29266 394.82952,523.23544 391.84406,524.17822 C 386.34452,524.80674 380.84498,525.43525 375.34545,526.06378 C 371.96717,525.90664 368.58887,525.74952 365.21059,525.59238 C 362.46082,525.51382 359.71105,525.43525 356.96128,525.35669 C 353.42587,524.49247 349.89045,523.62827 346.35503,522.76405 C 345.17656,521.82128 343.99809,520.87850 342.81962,519.93572 C 339.75559,517.81447 336.69157,515.69322 333.62754,513.57197 C 328.75652,508.30813 323.88551,503.04429 319.01448,497.78044 C 319.01448,496.52341 319.01448,495.26636 319.01448,494.00933 C 319.87870,494.00933 320.74291,494.00933 321.60712,494.00933 C 321.13574,492.83086 320.66435,491.65239 320.19296,490.47392 C 319.09305,488.19554 317.99314,485.91716 316.89323,483.63878 C 316.89323,482.93170 316.89323,482.22461 316.89323,481.51753 C 318.38597,480.26049 319.87869,479.00345 321.37143,477.74642 C 320.03583,475.54660 318.70022,473.34679 317.36462,471.14697 C 317.28606,470.83271 317.20748,470.51845 317.12892,470.20419 C 318.46453,468.39720 319.80013,466.59021 321.13574,464.78322 C 320.74291,463.68331 320.35009,462.58341 319.95726,461.48350 C 319.09305,460.38359 318.22883,459.28369 317.36462,458.18378 C 317.12892,457.31956 316.89323,456.45536 316.65753,455.59114 C 317.75744,454.17697 318.85735,452.76281 319.95726,451.34864 C 319.87870,450.01304 319.80013,448.67744 319.72157,447.34184 C 319.32874,446.71332 318.93592,446.08480 318.54310,445.45628 C 318.62166,444.74920 318.70023,444.04212 318.77879,443.33503 C 319.48588,443.25647 320.19296,443.17790 320.90004,443.09934 C 324.04263,445.22059 327.18523,447.34184 330.32782,449.46309 C 348.08347,456.92674 391.76550,461.09068 419.65600,444.27781 z " id="path7284" sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccc" style="fill:#fba246;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 389.86281,523.00744 C 389.46998,521.82897 391.23336,522.26765 390.84054,521.08918 C 383.37688,521.01061 375.91323,520.93205 368.44957,520.85348 C 368.44957,520.53923 368.44957,520.22496 368.44957,519.91070 C 374.10624,519.75357 379.76290,519.59645 385.41957,519.43932 C 388.24790,518.88937 391.07623,518.33941 393.90457,517.78946 C 395.39730,517.55377 396.89003,517.31807 398.38277,517.08237 C 401.44679,515.03969 404.51082,512.99701 407.57485,510.95432 C 407.49629,510.64006 407.41771,510.32580 407.33915,510.01153 C 401.36822,510.48292 395.39730,510.95432 389.42637,511.42571 C 387.30512,511.81853 385.18387,512.21135 383.06263,512.60418 C 379.13438,512.36849 375.20615,512.13279 371.27790,511.89710 C 369.78518,511.73997 368.29244,511.58284 366.79971,511.42571 C 364.44277,510.32580 362.08582,509.22589 359.72888,508.12598 C 376.54175,507.18320 396.89003,507.18320 415.11707,493.98432 C 391.31192,502.15506 371.27790,500.19093 355.01499,497.99112 C 375.91322,494.06288 396.57577,493.19867 417.00262,478.42849 C 387.38368,489.42756 366.24975,485.57788 349.35832,483.84946 C 371.51360,479.29269 403.56804,478.27136 414.40998,466.64376 C 383.06263,474.89306 355.95776,473.47890 338.75207,469.47210 C 352.81517,467.58654 366.87827,465.70098 380.94137,463.81543 C 374.10624,463.18691 367.27110,462.55840 360.43596,461.92988 C 373.32059,459.73006 386.20522,457.53024 399.08985,455.33043 C 381.88416,456.19465 346.53000,460.82997 319.89653,444.48849 C 323.66763,447.63108 328.61721,449.83090 331.20985,453.91627 C 327.28161,453.44487 323.35338,452.97349 319.42513,452.50210 C 319.66083,453.83770 319.89653,455.17330 320.13222,456.50890 C 324.13902,459.02298 328.14582,461.53704 332.15263,464.05112 C 327.43875,466.25093 322.72485,468.45075 318.01096,470.65057 C 323.90332,472.53612 329.79568,474.42169 335.68805,476.30724 C 330.03138,478.66418 322.48915,476.30724 318.71804,483.37807 C 325.55318,486.59923 335.21666,487.22774 339.22346,493.04154 C 333.33110,493.51293 326.73166,489.27043 321.54639,494.45571 C 327.67444,498.06968 333.80249,501.68367 339.93055,505.29765 C 336.55226,504.82626 333.17397,504.35487 329.79568,503.88348 C 334.58814,509.30445 341.26727,513.37780 346.05972,518.79877 C 362.00838,520.29150 373.91416,521.51471 389.86281,523.00744 z " id="path6556" sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccc" style="fill:#ffc080;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 410.63580,448.38806 C 375.91016,459.46570 347.07688,453.33765 330.49970,448.38806 C 332.54238,449.09515 334.58507,449.80223 336.62775,450.50931 C 365.30391,460.56561 396.80839,453.41621 407.80747,450.27362 C 408.75025,449.64510 409.69303,449.01658 410.63580,448.38806 z " id="path7286" sodipodi:nodetypes="ccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 431.22109,368.33927 C 427.74256,388.71364 424.26401,409.08801 420.78546,429.46237 C 416.60557,437.06563 407.94091,440.30372 400.07083,442.61238 C 391.48668,445.18530 382.40444,445.05799 373.54205,444.61656 C 371.08048,446.38986 364.99205,442.92177 370.06503,441.81235 C 377.17154,440.98795 384.60188,442.10538 391.38552,439.26558 C 401.04319,435.47671 410.26670,429.97354 417.05844,422.00834 C 421.19961,403.95301 425.34070,385.89766 429.48184,367.84233 C 430.06159,368.00798 430.64135,368.17360 431.22109,368.33927 z " id="path3629" style="fill:#ffffff;fill-opacity:0.64285713;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 353.42087,428.84088 L 351.10708,419.00725 L 351.68553,378.22661 L 353.13164,373.45440 L 353.05576,339.28565 L 349.95018,336.28751 L 349.37173,316.04336 C 363.86558,304.49563 376.56238,306.21837 388.70625,316.23514 L 388.12780,336.28907 L 385.23556,339.18131 L 384.65711,373.58108 L 386.39245,378.21491 L 385.81401,427.68398 L 382.34331,429.99778 L 374.24503,428.84088 L 371.35278,425.37019 L 366.14675,425.37019 L 360.94071,429.41933 L 353.42087,428.84088 z " id="path3619" sodipodi:nodetypes="ccccccccccccccccccc" style="fill:#c1c1c1;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#9b989f;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 358.25832,325.31572 L 358.25832,416.41507" id="path5096" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 380.15345,325.31572 L 380.15345,416.41507" id="path5824" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 361.91098,325.31572 L 361.91098,416.41507" id="path5826" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#8f8f92;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 376.52161,325.31572 L 376.52161,416.41507" id="path6554" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#8f8f92;stroke-width:0.91160071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <g id="g9475" transform="matrix(0.911601,0.000000,0.000000,0.911601,328.5961,-156.2531)"> + <path d="M 86.864034,673.56687 L 79.199560,676.97330 L 77.155700,678.67652 L 75.793127,679.69845 L 65.573829,679.35780 L 65.403508,678.33587 L 70.683478,676.97330 C 70.683478,676.97330 74.430554,676.63266 75.111841,676.46234 C 75.793127,676.29201 78.688595,674.92944 78.688595,674.92944 L 84.649852,671.52301 L 87.034355,671.52301 L 86.864034,673.56687 z " id="path8741" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 91.973683,686.34099 L 88.056285,686.17067 L 85.331139,687.53324 L 81.073098,689.23646 L 77.836987,691.45064 L 75.111841,692.30225 L 70.853800,692.64289 L 69.320905,693.15386 L 71.024122,693.83514 L 75.963449,693.83514 L 80.221490,694.51643 L 83.627923,693.83514 L 87.545320,690.42871 C 87.545320,690.42871 90.270466,689.23646 90.951753,688.89581 C 91.633039,688.55517 93.165934,687.87388 93.165934,687.87388 L 91.973683,686.34099 z " id="path8743" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 94.017542,700.30736 L 89.078215,703.03251 L 85.842104,705.07637 L 83.457601,706.94991 L 77.836987,708.14216 L 75.622806,708.14216 L 81.584063,710.01570 L 86.353069,707.97184 L 91.292396,705.58733 L 92.825291,704.05444 L 94.017542,700.30736 z " id="path8745" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 91.462718,717.85049 C 91.462718,717.85049 81.924706,721.59757 81.584063,722.27885 C 81.243420,722.96014 78.688595,723.98207 78.688595,723.98207 L 72.897660,724.66336 L 71.024122,725.68529 L 76.644736,726.36657 L 82.435671,724.49304 L 86.693712,724.32271 L 89.929823,722.10853 L 91.462718,720.40532 L 91.462718,717.85049 z " id="path8747" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + </g> + <path d="M 378.14273,525.28637 C 377.57434,530.51553 378.00099,537.83204 377.43261,543.06120 C 372.27918,543.00443 367.82875,543.82657 360.97078,541.72320 C 359.43614,536.89190 356.80919,529.30796 355.27454,524.47667 C 356.26507,524.72572 356.68741,524.86790 357.82038,524.93742 C 358.95335,525.00694 360.79692,524.96593 361.90337,525.03791 C 363.00981,525.10990 364.25012,525.06768 365.31257,525.13480 C 366.37503,525.20191 367.41113,525.22689 368.41214,525.28180 C 369.41314,525.33669 370.37905,525.38365 371.30113,525.41898 C 372.22321,525.45432 374.35115,525.55378 375.17683,525.56221 C 376.00251,525.57065 375.56381,525.48806 376.27564,525.46225 C 376.98745,525.43643 377.56225,525.35378 378.14273,525.28637 z " id="path10207" sodipodi:nodetypes="ccccsssssssc" style="fill:#ffffff;fill-opacity:0.31547615;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"/> + <path d="M 467.06377,199.37552 L 453.69293,208.53364 L 451.86130,221.53816 L 468.71223,214.21167 L 467.06377,199.37552 z " id="path16869" style="fill:#fefefe;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;opacity:1.0000000;color:#000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/toc-blank.png b/tools/auto_index/doc/html/images/toc-blank.png Binary files differnew file mode 100644 index 0000000000..6ffad17a0c --- /dev/null +++ b/tools/auto_index/doc/html/images/toc-blank.png diff --git a/tools/auto_index/doc/html/images/toc-minus.png b/tools/auto_index/doc/html/images/toc-minus.png Binary files differnew file mode 100644 index 0000000000..abbb020c8e --- /dev/null +++ b/tools/auto_index/doc/html/images/toc-minus.png diff --git a/tools/auto_index/doc/html/images/toc-plus.png b/tools/auto_index/doc/html/images/toc-plus.png Binary files differnew file mode 100644 index 0000000000..941312ce0d --- /dev/null +++ b/tools/auto_index/doc/html/images/toc-plus.png diff --git a/tools/auto_index/doc/html/images/up.png b/tools/auto_index/doc/html/images/up.png Binary files differnew file mode 100644 index 0000000000..17d9c3ec49 --- /dev/null +++ b/tools/auto_index/doc/html/images/up.png diff --git a/tools/auto_index/doc/html/images/up.svg b/tools/auto_index/doc/html/images/up.svg new file mode 100644 index 0000000000..d31aa9c809 --- /dev/null +++ b/tools/auto_index/doc/html/images/up.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:none;stroke:none;"> + <!ENTITY st1 "fill:#FFFFFF;stroke:#FFFFFF;stroke-width:7.5901;stroke-linejoin:round;"> + <!ENTITY st2 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st3 "stroke:none;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_3" style="&st2;"> + <g> + <path style="&st1;" d="M41.1,25.6c0.3,0,0.3-0.3,0.2-0.5L24.4,8.4c-0.5-0.5-0.7-0.4-1,0L6.7,25.1c-0.1,0.1-0.1,0.4,0.1,0.4h10v13.6c0,0.3,0.2,0.5,0.4,0.5l13.3,0c0.3,0,0.5-0.2,0.5-0.5V25.5l10.1,0.1z"/> + <path style="&st3;" d="M41.1,25.6c0.3,0,0.3-0.3,0.2-0.5L24.4,8.4c-0.5-0.5-0.7-0.4-1,0L6.7,25.1c-0.1,0.1-0.1,0.4,0.1,0.4h10v13.6c0,0.3,0.2,0.5,0.4,0.5l13.3,0c0.3,0,0.5-0.2,0.5-0.5V25.5l10.1,0.1z"/> + </g> + </g> + <g id="crop_x0020_marks" style="&st2;"> + <path style="&st0;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/images/up_disabled.png b/tools/auto_index/doc/html/images/up_disabled.png Binary files differnew file mode 100644 index 0000000000..e22bc87121 --- /dev/null +++ b/tools/auto_index/doc/html/images/up_disabled.png diff --git a/tools/auto_index/doc/html/images/warning.png b/tools/auto_index/doc/html/images/warning.png Binary files differnew file mode 100644 index 0000000000..1c33db8f34 --- /dev/null +++ b/tools/auto_index/doc/html/images/warning.png diff --git a/tools/auto_index/doc/html/images/warning.svg b/tools/auto_index/doc/html/images/warning.svg new file mode 100644 index 0000000000..fc8d7484cb --- /dev/null +++ b/tools/auto_index/doc/html/images/warning.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In --> +<!DOCTYPE svg [ + <!ENTITY st0 "fill:#000000;stroke:#FFFFFF;stroke-width:7.9139;stroke-linejoin:round;"> + <!ENTITY st1 "fill-rule:nonzero;clip-rule:nonzero;fill:#FFFFFF;stroke:#000000;stroke-miterlimit:4;"> + <!ENTITY st2 "fill:none;stroke:none;"> + <!ENTITY st3 "fill:#000000;"> + <!ENTITY st4 "fill-rule:evenodd;clip-rule:evenodd;stroke:none;"> + <!ENTITY st5 "fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;"> +]> +<svg width="48pt" height="48pt" viewBox="0 0 48 48" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> + <g id="Layer_x0020_4" style="&st1;"> + <g style="&st4;"> + <path style="&st0;" d="M16.4,42.3L5.7,31.6V16.4L16.4,5.7h15.2l10.7,10.7v15.2L31.6,42.3H16.4z"/> + <path style="&st3;" d="M16.4,42.3L5.7,31.6V16.4L16.4,5.7h15.2l10.7,10.7v15.2L31.6,42.3H16.4z"/> + <path d="M11.7,17.7l18.7,18.7l5.9-5.9L17.6,11.7l-5.9,5.9z"/> + <path d="M11.7,30.5l5.9,5.9l18.7-18.7l-5.9-5.9L11.7,30.5z"/> + </g> + </g> + <g id="crop_x0020_marks" style="&st5;"> + <path style="&st2;" d="M48,48H0V0h48v48z"/> + </g> +</svg> diff --git a/tools/auto_index/doc/html/index.html b/tools/auto_index/doc/html/index.html new file mode 100644 index 0000000000..80b322449b --- /dev/null +++ b/tools/auto_index/doc/html/index.html @@ -0,0 +1,83 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Boost.AutoIndex</title> +<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="index.html" title="Boost.AutoIndex"> +<link rel="next" href="boost_autoindex/overview.html" title="Overview"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> +<td align="center"><a href="../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"><a accesskey="n" href="boost_autoindex/overview.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div> +<div class="article"> +<div class="titlepage"> +<div> +<div><h2 class="title"> +<a name="boost_autoindex"></a>Boost.AutoIndex</h2></div> +<div><div class="authorgroup"><div class="author"><h3 class="author"> +<span class="firstname">John</span> <span class="surname">Maddock</span> +</h3></div></div></div> +<div><p class="copyright">Copyright © 2008, 2011 John Maddock</p></div> +<div><div class="legalnotice"> +<a name="id1003974"></a><p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></div> +</div> +<hr> +</div> +<div class="toc"> +<p><b>Table of Contents</b></p> +<dl> +<dt><span class="section"><a href="boost_autoindex/overview.html">Overview</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut.html">Getting Started and Tutorial</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="boost_autoindex/tut/build.html">Step 1: Build the AutoIndex + tool</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/configure.html">Step 2: Configure Boost.Build + jamfile to use AutoIndex</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="boost_autoindex/tut/configure/options.html">Available Indexing + Options</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/configure/optional.html">Making AutoIndex + optional</a></span></dt> +</dl></dd> +<dt><span class="section"><a href="boost_autoindex/tut/add_indexes.html">Step 3: Add indexes + to your documentation</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/script.html">Step 4: Create the .idx script + file - to control what to terms to index</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/entries.html">Step 5: Add Manual Index + Entries to Docbook XML - Optional</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/pis.html">Step 6: Using XML processing + instructions to control what gets indexed.</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/build_docs.html">Step 7: Build the Docs</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/tut/refine.html">Step 8: Iterate - to refine + your index</a></span></dt> +</dl></dd> +<dt><span class="section"><a href="boost_autoindex/script_ref.html">Script File (.idx) Reference</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/workflow.html">Understanding The AutoIndex Workflow</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/xml.html">XML Handling</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/qbk.html">Quickbook Support</a></span></dt> +<dt><span class="section"><a href="boost_autoindex/comm_ref.html">Command Line Reference</a></span></dt> +<dt><span class="section"><a href="index/s08.html">Index</a></span></dt> +</dl> +</div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"><p><small>Last revised: July 14, 2011 at 15:55:33 GMT</small></p></td> +<td align="right"><div class="copyright-footer"></div></td> +</tr></table> +<hr> +<div class="spirit-nav"><a accesskey="n" href="boost_autoindex/overview.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div> +</body> +</html> diff --git a/tools/auto_index/doc/html/index/s07.html b/tools/auto_index/doc/html/index/s07.html new file mode 100644 index 0000000000..6701e5e946 --- /dev/null +++ b/tools/auto_index/doc/html/index/s07.html @@ -0,0 +1,585 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Index</title> +<link rel="stylesheet" href="../boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.74.0"> +<link rel="home" href="../index.html" title="AutoIndex"> +<link rel="up" href="../index.html" title="AutoIndex"> +<link rel="prev" href="../autoindex/comm_ref.html" title="Command Line Reference"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../autoindex/comm_ref.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a> +</div> +<div class="section" lang="en"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="id1054189"></a>Index</h2></div></div></div> +<p><a class="link" href="s07.html#idx_id_0">A</a> <a class="link" href="s07.html#idx_id_1">B</a> <a class="link" href="s07.html#idx_id_2">C</a> <a class="link" href="s07.html#idx_id_3">D</a> <a class="link" href="s07.html#idx_id_4">F</a> <a class="link" href="s07.html#idx_id_5">H</a> <a class="link" href="s07.html#idx_id_6">I</a> <a class="link" href="s07.html#idx_id_7">J</a> <a class="link" href="s07.html#idx_id_8">L</a> <a class="link" href="s07.html#idx_id_9">M</a> <a class="link" href="s07.html#idx_id_10">O</a> <a class="link" href="s07.html#idx_id_11">P</a> <a class="link" href="s07.html#idx_id_12">Q</a> <a class="link" href="s07.html#idx_id_13">S</a> <a class="link" href="s07.html#idx_id_14">T</a> <a class="link" href="s07.html#idx_id_15">U</a> <a class="link" href="s07.html#idx_id_16">V</a> <a class="link" href="s07.html#idx_id_17">X</a> </p> +<div class="variablelist"><dl> +<dt> +<a name="idx_id_0"></a><span class="term">A</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">appendix</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +<dt><span class="term">AutoIndex</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../index.html" title="AutoIndex">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">Step 1: Build the AutoIndex tool</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Step 5: Add Manual Index Entries to Docbook XML - Optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +<dt><span class="term">Available Indexing Options</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">appendix</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">chapter</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">debug</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">page</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">stylesheet</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">verbose</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">XML</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">XSL</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">XSL stylesheet</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_1"></a><span class="term">B</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">bjam</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">Step 1: Build the AutoIndex tool</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +<dt><span class="term">Boost.Build</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +<dt><span class="term">Boostbook</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">Step 1: Build the AutoIndex tool</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_2"></a><span class="term">C</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">C++</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +<dt><span class="term">chapter</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +<dt><span class="term">class</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +<dt><span class="term">Command Line Reference</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">appendix</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">chapter</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">stylesheet</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">XML</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">XSL</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">XSL stylesheet</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_3"></a><span class="term">D</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">debug</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +</table></dd> +<dt><span class="term">Docbook</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Step 5: Add Manual Index Entries to Docbook XML - Optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +<dt><span class="term">Doxygen</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_4"></a><span class="term">F</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">function</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_5"></a><span class="term">H</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">html</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +<dt><span class="term">hyperlink</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"><tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr></table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_6"></a><span class="term">I</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">index</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">Step 1: Build the AutoIndex tool</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Step 5: Add Manual Index Entries to Docbook XML - Optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_7"></a><span class="term">J</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">jamfile</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_8"></a><span class="term">L</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">log file</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_9"></a><span class="term">M</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">macro</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +<dt><span class="term">Making AutoIndex optional</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">bjam</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Boost.Build</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">html</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">jamfile</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">log file</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">section</a></p></td></tr> +</table></dd> +<dt><span class="term">MSVC</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"><tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr></table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_10"></a><span class="term">O</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">Overview</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">appendix</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Boost.Build</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Boostbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">C++</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">chapter</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">class</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Doxygen</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">function</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">html</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">hyperlink</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">jamfile</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">macro</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">page</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">PDF</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">plural</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">stylesheet</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">typedef</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">XML</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">XSL</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">XSL stylesheet</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_11"></a><span class="term">P</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">page</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +<dt><span class="term">PDF</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +<dt><span class="term">plural</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_12"></a><span class="term">Q</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">Quickbook</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_13"></a><span class="term">S</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">script</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +<dt><span class="term">Script File (.idx) Reference</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">C++</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">class</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">debug</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">function</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">log file</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">macro</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">plural</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">text</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">typedef</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">XML</a></p></td></tr> +</table></dd> +<dt><span class="term">section</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure/optional.html" title="Making AutoIndex optional">Making AutoIndex optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Step 7: Iterate - to refine your index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +<dt><span class="term">side-by-side</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"><tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr></table></dd> +<dt><span class="term">Step 1: Build the AutoIndex tool</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">bjam</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">Boostbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool">index</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Boost.Build</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Boostbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">html</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">jamfile</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">log file</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">MSVC</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">PDF</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">side-by-side</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">verbose</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 3: Add indexes to your documentation</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">appendix</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Boostbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">C++</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">chapter</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">class</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Doxygen</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">function</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">html</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">jamfile</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">macro</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">page</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">PDF</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">stylesheet</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">typedef</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">XML</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">XSL</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">XSL stylesheet</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 4: Create the .idx script file - to control what to terms to index</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">C++</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Doxygen</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">plural</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">text</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">XML</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 6: Build the Docs</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">bjam</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Boost.Build</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">debug</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">html</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">log file</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">PDF</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">verbose</a></p></td></tr> +</table></dd> +<dt><span class="term">Step 7: Iterate - to refine your index</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">debug</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/refine.html" title="Step 7: Iterate - to refine your index">section</a></p></td></tr> +</table></dd> +<dt><span class="term">stylesheet</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_14"></a><span class="term">T</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">text</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index">Step 4: Create the .idx script file - to control what to terms to index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +<dt><span class="term">typedef</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_15"></a><span class="term">U</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">Understanding The AutoIndex Workflow</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Boostbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">C++</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Docbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Doxygen</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Quickbook</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">stylesheet</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">text</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">XML</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">XSL</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">XSL stylesheet</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_16"></a><span class="term">V</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">verbose</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex">Step 2: Configure Boost.Build jamfile to use AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/build_docs.html" title="Step 6: Build the Docs">Step 6: Build the Docs</a></p></td></tr> +</table></dd> +</dl></div></dd> +<dt> +<a name="idx_id_17"></a><span class="term">X</span> +</dt> +<dd><div class="variablelist"><dl> +<dt><span class="term">XML</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/script_ref.html" title="Script File (.idx) Reference">Script File (.idx) Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional">Step 5: Add Manual Index Entries to Docbook XML - Optional</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML Handling</a></p></td></tr> +</table></dd> +<dt><span class="term">XML Handling</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">AutoIndex</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">index</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">script</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">section</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">text</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/xml.html" title="XML Handling">XML</a></p></td></tr> +</table></dd> +<dt><span class="term">XSL</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +<dt><span class="term">XSL stylesheet</span></dt> +<dd><table class="simplelist" border="0" summary="Simple list"> +<tr><td><p><a class="link" href="../autoindex/tut/configure/options.html" title="Available Indexing Options">Available Indexing Options</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/comm_ref.html" title="Command Line Reference">Command Line Reference</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/overview.html" title="Overview">Overview</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation">Step 3: Add indexes to your documentation</a></p></td></tr> +<tr><td><p><a class="link" href="../autoindex/workflow.html" title="Understanding The AutoIndex Workflow">Understanding The AutoIndex Workflow</a></p></td></tr> +</table></dd> +</dl></div></dd> +</dl></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008 , 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../autoindex/comm_ref.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/index/s08.html b/tools/auto_index/doc/html/index/s08.html new file mode 100644 index 0000000000..929b206bcc --- /dev/null +++ b/tools/auto_index/doc/html/index/s08.html @@ -0,0 +1,718 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Index</title> +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<link rel="home" href="../index.html" title="Boost.AutoIndex"> +<link rel="up" href="../index.html" title="Boost.AutoIndex"> +<link rel="prev" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> +<td align="center"><a href="../../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../boost_autoindex/comm_ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="id1018804"></a>Index</h2></div></div></div> +<p><a class="link" href="s08.html#idx_id_0">A</a> <a class="link" href="s08.html#idx_id_1">B</a> <a class="link" href="s08.html#idx_id_2">C</a> <a class="link" href="s08.html#idx_id_3">D</a> <a class="link" href="s08.html#idx_id_4">F</a> <a class="link" href="s08.html#idx_id_5">H</a> <a class="link" href="s08.html#idx_id_6">I</a> <a class="link" href="s08.html#idx_id_7">J</a> <a class="link" href="s08.html#idx_id_8">L</a> <a class="link" href="s08.html#idx_id_9">M</a> <a class="link" href="s08.html#idx_id_10">O</a> <a class="link" href="s08.html#idx_id_11">P</a> <a class="link" href="s08.html#idx_id_12">Q</a> <a class="link" href="s08.html#idx_id_13">S</a> <a class="link" href="s08.html#idx_id_14">T</a> <a class="link" href="s08.html#idx_id_15">U</a> <a class="link" href="s08.html#idx_id_16">V</a> <a class="link" href="s08.html#idx_id_17">X</a></p> +<div class="variablelist"><dl> +<dt> +<a name="idx_id_0"></a><span class="term">A</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">appendix</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">AutoIndex</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../index.html" title="Boost.AutoIndex"><span class="index-entry-level-1">Boost.AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">Step 1: Build the AutoIndex tool</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Available Indexing Options</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">appendix</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">chapter</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">debug</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">page</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">stylesheet</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">verbose</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">XML</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">XSL</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">XSL stylesheet</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_1"></a><span class="term">B</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">bjam</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">Step 1: Build the AutoIndex tool</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Boost.AutoIndex</span></p> +<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../index.html" title="Boost.AutoIndex"><span class="index-entry-level-1">AutoIndex</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Boost.Build</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Boostbook</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">Step 1: Build the AutoIndex tool</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_2"></a><span class="term">C</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">C++</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">chapter</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">class</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Command Line Reference</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">appendix</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">chapter</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">stylesheet</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">XML</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">XSL</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">XSL stylesheet</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_3"></a><span class="term">D</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">debug</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Docbook</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Doxygen</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_4"></a><span class="term">F</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">function</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_5"></a><span class="term">H</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">html</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">hyperlink</span></p> +<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li></ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_6"></a><span class="term">I</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">index</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">Step 1: Build the AutoIndex tool</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_7"></a><span class="term">J</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">jamfile</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_8"></a><span class="term">L</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">log file</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_9"></a><span class="term">M</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">macro</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Making AutoIndex optional</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">bjam</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Boost.Build</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">html</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">jamfile</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">log file</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">section</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">MSVC</span></p> +<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li></ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_10"></a><span class="term">O</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Overview</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">appendix</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Boost.Build</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Boostbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">C++</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">chapter</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">class</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Doxygen</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">function</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">html</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">hyperlink</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">jamfile</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">macro</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">page</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">PDF</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">plural</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">stylesheet</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">typedef</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">XML</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">XSL</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">XSL stylesheet</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_11"></a><span class="term">P</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">page</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">PDF</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">plural</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_12"></a><span class="term">Q</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Quickbook</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Quickbook Support</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">class</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">jamfile</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">section</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_13"></a><span class="term">S</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">script</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Script File (.idx) Reference</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">C++</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">class</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">debug</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">function</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">log file</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">macro</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">plural</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">text</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">typedef</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">XML</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">section</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/optional.html" title="Making AutoIndex optional"><span class="index-entry-level-1">Making AutoIndex optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/qbk.html" title="Quickbook Support"><span class="index-entry-level-1">Quickbook Support</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Step 8: Iterate - to refine your index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">side-by-side</span></p> +<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 1: Build the AutoIndex tool</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">bjam</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">Boostbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build.html" title="Step 1: Build the AutoIndex tool"><span class="index-entry-level-1">index</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Boost.Build</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Boostbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">html</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">jamfile</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">log file</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">MSVC</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">PDF</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">side-by-side</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">verbose</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 3: Add indexes to your documentation</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">appendix</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Boostbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">chapter</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">class</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Doxygen</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">function</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">html</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">jamfile</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">macro</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">page</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">PDF</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">stylesheet</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">typedef</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">XML</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">XSL</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">XSL stylesheet</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 4: Create the .idx script file - to control what to terms to index</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">C++</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Doxygen</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">plural</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">text</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">XML</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 6: Using XML processing instructions to control what gets indexed.</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">appendix</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">chapter</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">text</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">XML</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 7: Build the Docs</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">bjam</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Boost.Build</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">debug</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">html</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">log file</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">PDF</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">verbose</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Step 8: Iterate - to refine your index</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">debug</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/refine.html" title="Step 8: Iterate - to refine your index"><span class="index-entry-level-1">section</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">stylesheet</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_14"></a><span class="term">T</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">text</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/script.html" title="Step 4: Create the .idx script file - to control what to terms to index"><span class="index-entry-level-1">Step 4: Create the .idx script file - to control what to terms to index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">typedef</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +<dt> +<a name="idx_id_15"></a><span class="term">U</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">Understanding The AutoIndex Workflow</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Boostbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">C++</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Docbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Doxygen</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Quickbook</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">stylesheet</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">text</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">XML</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">XSL</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">XSL stylesheet</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_16"></a><span class="term">V</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">verbose</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"><span class="index-entry-level-1">Step 2: Configure Boost.Build jamfile to use AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/build_docs.html" title="Step 7: Build the Docs"><span class="index-entry-level-1">Step 7: Build the Docs</span></a></p></li> +</ul></div> +</li></ul></div></dd> +<dt> +<a name="idx_id_17"></a><span class="term">X</span> +</dt> +<dd><div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">XML</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/script_ref.html" title="Script File (.idx) Reference"><span class="index-entry-level-1">Script File (.idx) Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/entries.html" title="Step 5: Add Manual Index Entries to Docbook XML - Optional"><span class="index-entry-level-1">Step 5: Add Manual Index Entries to Docbook XML - Optional</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/pis.html" title="Step 6: Using XML processing instructions to control what gets indexed."><span class="index-entry-level-1">Step 6: Using XML processing instructions to control what gets indexed.</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML Handling</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">XML Handling</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">AutoIndex</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">index</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">script</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">section</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">text</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/xml.html" title="XML Handling"><span class="index-entry-level-1">XML</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">XSL</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +<li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">XSL stylesheet</span></p> +<div class="index"><ul class="index" type="none" compact> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/configure/options.html" title="Available Indexing Options"><span class="index-entry-level-1">Available Indexing Options</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/comm_ref.html" title="Command Line Reference"><span class="index-entry-level-1">Command Line Reference</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/tut/add_indexes.html" title="Step 3: Add indexes to your documentation"><span class="index-entry-level-1">Step 3: Add indexes to your documentation</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../boost_autoindex/workflow.html" title="Understanding The AutoIndex Workflow"><span class="index-entry-level-1">Understanding The AutoIndex Workflow</span></a></p></li> +</ul></div> +</li> +</ul></div></dd> +</dl></div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"></td> +<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> + Distributed under the Boost Software License, Version 1.0. (See accompanying + 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>) + </p> +</div></td> +</tr></table> +<hr> +<div class="spirit-nav"> +<a accesskey="p" href="../boost_autoindex/comm_ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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> +</div> +</body> +</html> diff --git a/tools/auto_index/doc/html/reference.css b/tools/auto_index/doc/html/reference.css new file mode 100644 index 0000000000..6826962afc --- /dev/null +++ b/tools/auto_index/doc/html/reference.css @@ -0,0 +1,11 @@ +/*============================================================================ + Copyright 2003-2004 Douglas Gregor + Distributed under the Boost Software License, Version 1.0. (See accompany- + ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +============================================================================*/ + +PRE.synopsis { + background-color: #e0ffff; + border: thin solid blue; + padding: 1em +}
\ No newline at end of file diff --git a/tools/auto_index/doc/students_t_eg_1.png b/tools/auto_index/doc/students_t_eg_1.png Binary files differnew file mode 100644 index 0000000000..485f1f1b9a --- /dev/null +++ b/tools/auto_index/doc/students_t_eg_1.png diff --git a/tools/auto_index/doc/students_t_eg_2.png b/tools/auto_index/doc/students_t_eg_2.png Binary files differnew file mode 100644 index 0000000000..8149dcb67b --- /dev/null +++ b/tools/auto_index/doc/students_t_eg_2.png diff --git a/tools/auto_index/doc/students_t_eg_3.png b/tools/auto_index/doc/students_t_eg_3.png Binary files differnew file mode 100644 index 0000000000..6fa55c116b --- /dev/null +++ b/tools/auto_index/doc/students_t_eg_3.png diff --git a/tools/auto_index/doc/students_t_eg_4.png b/tools/auto_index/doc/students_t_eg_4.png Binary files differnew file mode 100644 index 0000000000..6f651ecc1a --- /dev/null +++ b/tools/auto_index/doc/students_t_eg_4.png diff --git a/tools/auto_index/include/auto_index_helpers.qbk b/tools/auto_index/include/auto_index_helpers.qbk new file mode 100644 index 0000000000..086c916308 --- /dev/null +++ b/tools/auto_index/include/auto_index_helpers.qbk @@ -0,0 +1,19 @@ + + +[template index[] +'''<index/>''' +] + +[template named_index[type title] +'''<index type="'''[type]'''"><title>'''[title]'''</title></index>''' +] + +[template AutoIndex [Args] '''<?BoostAutoIndex ''' [Args]'''?>'''] + +[template indexterm1 [primary] '''<indexterm><primary>'''[primary]'''</primary></indexterm>'''] +[template indexterm2 [primary secondary] '''<indexterm><primary>'''[primary]'''</primary><secondary>'''[secondary]'''</secondary></indexterm>'''] +[template indexterm3 [primary secondary tertiary] '''<indexterm><primary>'''[primary]'''</primary><secondary>'''[secondary]'''</secondary><tertiary>'''[tertiary]'''</tertiary></indexterm>'''] + +[template typed_indexterm1 [type primary] '''<indexterm type="'''[type]'''"><primary>'''[primary]'''</primary></indexterm>'''] +[template typed_indexterm2 [type primary secondary] '''<indexterm type="'''[type]'''"><primary>'''[primary]'''</primary><secondary>'''[secondary]'''</secondary></indexterm>'''] +[template typed_indexterm3 [type primary secondary tertiary] '''<indexterm type="'''[type]'''"><primary>'''[primary]'''</primary><secondary>'''[secondary]'''</secondary><tertiary>'''[tertiary]'''</tertiary></indexterm>'''] diff --git a/tools/auto_index/index.html b/tools/auto_index/index.html new file mode 100644 index 0000000000..df7430bd0e --- /dev/null +++ b/tools/auto_index/index.html @@ -0,0 +1,15 @@ +<html> + <head> + <meta http-equiv="refresh" content="0; URL=doc/html/index.html"> + </head> + <body> + <P> + Automatic redirection failed, please go to <a href="doc/html/index.html">doc/html/index.html</a>. + </P> + <P>Copyright John Maddock 2001</P> + <P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt"> + LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P> + </body> +</html> + + diff --git a/tools/auto_index/src/auto_index.cpp b/tools/auto_index/src/auto_index.cpp new file mode 100644 index 0000000000..f108885c79 --- /dev/null +++ b/tools/auto_index/src/auto_index.cpp @@ -0,0 +1,778 @@ +// Copyright 2008 John Maddock +// +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <set> +#include <cstring> +#include <boost/array.hpp> +#include <boost/exception/all.hpp> +#include <boost/program_options.hpp> +#include "auto_index.hpp" + +std::string infile, outfile, prefix, last_primary, last_secondary, last_tertiary; +std::set<index_info> index_terms; +std::set<std::pair<std::string, std::string> > found_terms; +bool no_duplicates = false; +bool verbose = false; +bool use_section_names = true; +index_entry_set index_entries; +boost::tiny_xml::element_list indexes; +std::list<id_rewrite_rule> id_rewrite_list; +bool internal_indexes = false; +std::string internal_index_type = "section"; +boost::regex debug; +file_scanner_set_type file_scanner_set; + +int help() +{ + std::cout << "Please refer to the documentation for the correct command line syntax" << std::endl; + return 1; +} + +void eat_block(std::string& result, std::istream & is) +{ + // + // everything until we get to a closing '>': + // + char c; + while(is.get(c) && c != '>') + { + result += c; + if(c == '\\') + { + is.get(c); + result += c; + } + } + result += c; +} + +std::string get_header(std::istream & is) +{ + // + // We need to get any leading <? and <! elements: + // + std::string result; + is >> std::ws; + if(is.get() != '<') + throw std::runtime_error("Invalid leading markup in XML file found"); + char c = is.peek(); + while((c == '?') || (c == '!')) + { + std::string temp; + std::getline(is, temp, '>'); + result += '<' + temp + '>'; + is >> std::ws; + if(is.get() != '<') + throw std::runtime_error("Invalid leading markup in XML file found"); + c = is.peek(); + result += '\n'; + } + return result; +} +// +// Find attribute named "name" in node "node": +// +const std::string* find_attr(boost::tiny_xml::element_ptr node, const char* name) +{ + for(boost::tiny_xml::attribute_list::const_iterator i = node->attributes.begin(); + i != node->attributes.end(); ++i) + { + if(i->name == name) + return &(i->value); + } + return 0; +} +// +// Get the ID of the current block scope, basically +// move up the XML tree until we find a valid ID: +// +const std::string* get_current_block_id(node_id const* id) +{ + while((id->id == 0) && (id->prev)) + id = id->prev; + return id->id; +} +// +// Get the title of the current block scope, basically +// move up the XML tree until we find a valid title: +// +const std::string& get_current_block_title(title_info const* id) +{ + while((id->title.size() == 0) && (id->prev)) + id = id->prev; + return id->title; +} +// +// Get all the content under this node, with any inline XML +// stripped out: +// +std::string get_consolidated_content(boost::tiny_xml::element_ptr node) +{ + std::string result(node->content); + for(boost::tiny_xml::element_list::const_iterator i = node->elements.begin(); + i != node->elements.end(); ++i) + { + result += " "; + result += get_consolidated_content(*i); + } + static const boost::regex e("(^[[:space:]]+)|([[:space:]]+)|([[:space:]]+$)"); + return regex_replace(result, e, "(?2 )", boost::regex_constants::format_all); +} +// +// Rewrite a title based on any rewrite rules we may have: +// +std::string rewrite_title(const std::string& title, const std::string& id) +{ + for(std::list<id_rewrite_rule>::const_iterator i = id_rewrite_list.begin(); i != id_rewrite_list.end(); ++i) + { + if(i->base_on_id) + { + if(regex_match(id, i->id)) + return i->new_name; + } + else + { + if(regex_match(title, i->id)) + return regex_replace(title, i->id, i->new_name); + } + } + return title; +} + +struct string_cmp +{ + bool operator()(const char* a, const char* b)const + { + return std::strcmp(a, b) < 0; + } +}; +// +// Discover whether this node can contain a <title> or not, if not +// we don't want to link to it, or the XSL HTML stylesheets may do strange +// things, and at least emit copious messages. See https://sourceforge.net/tracker/?func=detail&aid=3325153&group_id=21935&atid=373747 +// +bool can_contain_title(const char* name) +{ + static const boost::array<const char*, 103> names = + { { + "abstract", "appendix", "appendixinfo", "article", "articleinfo", "authorblurb", "bibliodiv", "biblioentry", "bibliography", + "bibliographyinfo", "bibliolist", "bibliomixed", "bibliomset", "biblioset", "blockinfo", "blockquote", "book", "bookinfo", + "calloutlist", "caution", "chapter", "chapterinfo", "colophon", "constraintdef", "dedication", "equation", "example", "figure", + "formalpara", "glossary", "glossaryinfo", "glossdiv", "glosslist", "important", "index", "indexdiv", "indexinfo", "itemizedlist", + "legalnotice", "lot", "msg", "msgexplan", "msgmain", "msgrel", "msgset", "msgsub", "note", "objectinfo", "orderedlist", "part", + "partinfo", "partintro", "personblurb", "preface", "prefaceinfo", "procedure", "productionset", "qandadiv", "qandaset", + "refentryinfo", "reference", "referenceinfo", "refsect1", "refsect1info", "refsect2", "refsect2info", "refsect3", "refsect3info", + "refsection", "refsectioninfo", "refsynopsisdiv", "refsynopsisdivinfo", "sect1", "sect1info", "sect2", "sect2info", "sect3", + "sect3info", "sect4", "sect4info", "sect5", "sect5info", "section", "sectioninfo", "segmentedlist", "set", "setindex", + "setindexinfo", "setinfo", "sidebar", "sidebarinfo", "simplesect", "step", "table", "task", "taskprerequisites", + "taskrelated", "tasksummary", "tip", "toc", "variablelist", "warning", "refentry" + } }; + static std::set<const char*, string_cmp> permitted; + + if(permitted.empty()) + permitted.insert(names.begin(), names.end()); + + return 0 != permitted.count(name); +} +// +// Determine whether this node can contain an indexterm or not: +// +bool can_contain_indexterm(const char* name) +{ + static const boost::array<const char*, 257> names = + { { + "abbrev", "accel", "ackno", "acronym", "action", "answer", "appendix", "appendixinfo", "application", + "article", "articleinfo", "artpagenums", "attribution", "authorinitials", "bibliocoverage", "bibliodiv", + "biblioentry", "bibliography", "bibliographyinfo", "biblioid", "bibliomisc", "bibliomixed", "bibliomset", + "bibliorelation", "biblioset", "bibliosource", "blockinfo", "blockquote", "bookinfo", "bridgehead", "callout", + "caution", "chapter", "chapterinfo", "citation", "citebiblioid", "citetitle", "city", "classname", "classsynopsisinfo", + "code", "collabname", "command", "computeroutput", "confdates", "confnum", "confsponsor", "conftitle", "constant", + "constraintdef", "contractnum", "contractsponsor", "contrib", "corpauthor", "corpcredit", "corpname", "country", + "database", "date", "dedication", "edition", "email", "emphasis", "entry", "envar", "errorcode", "errorname", "errortext", + "errortype", "example", "exceptionname", "fax", "figure", "filename", "firstname", "firstterm", "foreignphrase", + "formalpara", "funcparams", "funcsynopsisinfo", "function", "glossary", "glossaryinfo", "glossdef", "glossdiv", + "glossentry", "glosssee", "glossseealso", "glossterm", "guibutton", "guiicon", "guilabel", "guimenu", "guimenuitem", + "guisubmenu", "hardware", "highlights", "holder", "honorific", "important", "index", "indexinfo", "informalexample", + "informalfigure", "initializer", "interface", "interfacename", "invpartnumber", "isbn", "issn", "issuenum", "itemizedlist", + "itermset", "jobtitle", "keycap", "keycode", "keysym", "label", "legalnotice", "lineage", "lineannotation", + /*"link", */"listitem", "literal", "literallayout", "lotentry", "manvolnum", "markup", "medialabel", "member", + "methodname", "modespec", "modifier", "mousebutton", "msgaud", "msgexplan", "msglevel", "msgorig", "msgtext", "note", + "objectinfo", "olink", "option", "optional", "orderedlist", "orgdiv", "orgname", "otheraddr", "othername", "package", + "pagenums", "para", "parameter", "partinfo", "partintro", "phone", "phrase", "pob", "postcode", "preface", "prefaceinfo", + "procedure", "productname", "productnumber", "programlisting", "prompt", "property", "pubdate", "publishername", + "pubsnumber", "qandadiv", "qandaset", "question", "quote", "refentry", "refentryinfo", "refentrytitle", "referenceinfo", + "refmeta", "refmiscinfo", "refpurpose", "refsect1", "refsect1info", "refsect2", "refsect2info", "refsect3", "refsect3info", + "refsection", "refsectioninfo", "refsynopsisdiv", "refsynopsisdivinfo", "releaseinfo", "remark", "returnvalue", + "revdescription", "revnumber", "revremark", "screen", "screeninfo", "sect1", "sect1info", "sect2", "sect2info", "sect3", + "sect3info", "sect4", "sect4info", "sect5", "sect5info", "section", "sectioninfo", "seg", "segtitle", "seriesvolnums", + "setindex", "setindexinfo", "setinfo", "sgmltag", "shortaffil", "sidebar", "sidebarinfo", "simpara", "simplesect", + "state", "step", "street", "structfield", "structname", "subtitle", "surname", "symbol", "synopsis", "systemitem", + "table", "task", "taskprerequisites", "taskrelated", "tasksummary", "td", "term", "termdef", "th", "tip", /*"title",*/ + "titleabbrev", "tocback", "tocentry", "tocfront", "token", "type", "ulink", "uri", "userinput", "variablelist", + "varname", "volumenum", "warning", "wordasword", "year" + } }; + static std::set<const char*, string_cmp> permitted; + + if(permitted.empty()) + permitted.insert(names.begin(), names.end()); + + return 0 != permitted.count(name); +} +// +// Decide whether to flatten this node for searching purposes: +// +bool should_flatten_node(const char* name) +{ + // + // The list of nodes to flatten is basically the list of elements that + // can appear inside a <section> - see http://www.docbook.org/tdg/en/html/section.html. + // In other words basically anything at the level of a paragraph/table/listing etc. + // + static const boost::array<const char*, 57> names = + { { + "title", "subtitle", "titleabbrev", + "toc", "lot", "glossary", "bibliography", + /*"calloutlist", "glosslist", "bibliolist", "itemizedlist", "orderedlist", + "segmentedlist", "simplelist", "variablelist",*/ "caution", "important", "note", + "tip", "warning", "literallayout", "programlisting", "programlistingco", + "screen", "screenco", "screenshot", "synopsis", "cmdsynopsis", "funcsynopsis", + "classsynopsis", "fieldsynopsis", "constructorsynopsis", + "destructorsynopsis", "methodsynopsis", "formalpara", "para", "simpara", + "address", "blockquote", "graphic", "graphicco", "mediaobject", + "mediaobjectco", "informalequation", "informalexample", "informalfigure", + "informaltable", "equation", "example", "figure", "table", "msgset", "procedure", + "sidebar", "qandaset", "task", "productionset", "constraintdef", "anchor", + "bridgehead", "remark", "highlights", "abstract", "authorblurb", "epigraph" + /*"biblioentry", "bibliomixed", "callout", "glossentry", "listitem", "seg", "seglistitem", "member", + "term", */ + } }; + static std::set<const char*, string_cmp> terminals; + + if(terminals.empty()) + terminals.insert(names.begin(), names.end()); + return 0 != terminals.count(name); +} +std::string unescape_xml(const std::string& s) +{ + boost::regex e("&(?:(quot)|(amp)|(apos)|(lt)|(gt));"); + return regex_replace(s, e, "(?1\")(?2&)(?3\')(?4<)(?5>)", boost::regex_constants::format_all); +} +// +// Exception classes to propagate processing instruction info: +// +struct ignore_section{}; +struct ignore_block{}; +// +// Check if we're in a section (or chapter etc) or not: +// +bool is_section(const std::string& name) +{ + static const boost::array<const char*, 19> data = + {{ + "dedication", "toc", "lot", "glossary", "bibliography", "preface", "chapter", + "reference", "part", "article", "appendix", "index", "setindex", "colophon", + "sect1", "refentry", "simplesect", "section", "partintro" + }}; + std::set<std::string> names; + if(names.empty()) + names.insert(data.begin(), data.end()); + return 0 != names.count(name); +} +// +// Check if we're in a block/paragraph or not: +// +bool is_block(const std::string& name) +{ + static const boost::array<const char*, 58> data = + {{ + "calloutlist", "glosslist", "bibliolist", "itemizedlist", "orderedlist", + "segmentedlist", "simplelist", "variablelist", "caution", "important", "note", + "tip", "warning", "literallayout", "programlisting", "programlistingco", + "screen", "screenco", "screenshot", "synopsis", "cmdsynopsis", "funcsynopsis", + "classsynopsis", "fieldsynopsis", "constructorsynopsis", + "destructorsynopsis", "methodsynopsis", "formalpara", "para", "simpara", + "address", "blockquote", "graphic", "graphicco", "mediaobject", + "mediaobjectco", "informalequation", "informalexample", "informalfigure", + "informaltable", "equation", "example", "figure", "table", "msgset", "procedure", + "sidebar", "qandaset", "task", "productionset", "constraintdef", "anchor", + "bridgehead", "remark", "highlights", "abstract", "authorblurb", "epigraph" + }}; + std::set<std::string> names; + if(names.empty()) + names.insert(data.begin(), data.end()); + return 0 != names.count(name); +} +// +// Helper proc to recurse through children: +// +void process_node(boost::tiny_xml::element_ptr node, node_id* prev, title_info* pt, bool seen); +bool recurse_through_children(boost::tiny_xml::element_ptr node, node_id* id, title_info* pt, bool seen) +{ + try + { + for(boost::tiny_xml::element_list::const_iterator i = node->elements.begin(); + i != node->elements.end(); ++i) + { + process_node(*i, id, pt, seen); + } + } + catch(const ignore_section&) + { + if(is_section(node->name)) + return false; + else + throw; + } + catch(const ignore_block&) + { + if(is_block(node->name) || is_section(node->name)) + return false; + else + throw; + } + return true; +} +// +// This does most of the work: process the node pointed to, and any children +// that it may have: +// +void process_node(boost::tiny_xml::element_ptr node, node_id* prev, title_info* pt, bool seen = false) +{ + // + // Store the current ID and title as nested scoped objects: + // + node_id id = { 0, prev }; + if(can_contain_title(node->name.c_str())) + { + // Only set the ID to link to if the block can contain a title, see + // can_contain_title above for rationale. + id.id = find_attr(node, "id"); + } + title_info title = { "", pt}; + bool flatten = should_flatten_node(node->name.c_str()); + + if(node->name.size() && node->name[0] == '?') + { + if(node->name == "?BoostAutoIndex") + { + if(node->content == "IgnoreSection") + { + throw ignore_section(); + } + else if(node->content == "IgnoreBlock") + { + throw ignore_block(); + } + } + return; // Ignore processing instructions + } + else if((node->name == "title") && (id.prev->id)) + { + // + // This actually sets the title of the enclosing scope, + // not this tag itself: + // + title.prev->title = get_consolidated_content(node); + if(verbose) + std::cout << "Indexing section: " << title.prev->title << std::endl; + } + else if((node->name == "refentrytitle") && (id.prev->prev->id)) + { + // + // This actually sets the title of the enclosing refentry scope, + // not this tag itself: + // + title.prev->prev->title = get_consolidated_content(node); + if(verbose) + std::cout << "Indexing refentry: " << title.prev->prev->title << std::endl; + } + if(node->name == "anchor") + { + if(node->parent.lock()->name == "title") + { + // We have a title with a nested anchor ID, change the ID of our parents parent to match: + id.prev->prev->id = id.id; + } + } + else if(node->name == "index") + { + // Keep track of all the indexes we see: + indexes.push_back(node); + if(node->parent.lock()->name == "para") + node->parent.lock()->name = ""; + } + else if(node->name == "primary") + { + last_primary = get_consolidated_content(node); + } + else if(node->name == "secondary") + { + last_secondary = get_consolidated_content(node); + } + else if(node->name == "tertiary") + { + last_tertiary = get_consolidated_content(node); + } + else if((node->name == "see") && internal_indexes) + { + std::cerr << "WARNING: <see> in XML source will be ignored for the index generation" << std::endl; + } + else if((node->name == "seealso") && internal_indexes) + { + std::cerr << "WARNING: <seealso> in XML source will be ignored for the index generation" << std::endl; + } + + std::string flattenned_text; + const std::string* ptext; + if(flatten) + { + flattenned_text = unescape_xml(get_consolidated_content(node)); + ptext = &flattenned_text; + // + // Recurse through children here if we're going to flatten the text, that way we see any processing instructions first: + // + if(!recurse_through_children(node, &id, &title, flatten || seen)) + return; + } + else + { + ptext = &(node->content); + } + + // + // Search content for items: we only search if the content is not empty, + // and the content is not whitespace alone, and we haven't already searched this + // text in one of our parent nodes that got flattened. + // + static const boost::regex space_re("[[:space:]]+"); + if(!seen && ptext->size() && !regex_match(*ptext, space_re)) + { + // Save block ID and title in case we find some hits: + const std::string* pid = get_current_block_id(&id); + const std::string& rtitle = get_current_block_title(&title); + const std::string simple_title = rewrite_title(rtitle, *pid); + // Scan for each index term: + for(std::set<index_info>::const_iterator i = index_terms.begin(); + i != index_terms.end(); ++i) + { + if(regex_search(*ptext, i->search_text)) + { + // + // We need to check to see if this term has already been indexed + // in this zone, in order to prevent duplicate entries, also check + // that any constrait placed on the term's ID is satisfied: + // + std::pair<std::string, std::string> item_index(*pid, i->term); + if(((no_duplicates == false) || (0 == found_terms.count(item_index))) + && (i->search_id.empty() || regex_match(*pid, i->search_id))) + { + // We have something to index! + found_terms.insert(item_index); + + if(!debug.empty() && (regex_match(i->term, debug) || regex_match(rtitle, debug) || regex_match(simple_title, debug))) + { + std::cout << "Debug term found, in block with ID: " << *pid << std::endl; + std::cout << "Current section title is: " << rtitle << std::endl; + std::cout << "The main index entry will be : " << simple_title << std::endl; + std::cout << "The indexed term is: " << i->term << std::endl; + std::cout << "The search regex is: " << i->search_text << std::endl; + std::cout << "The section constraint is: " << i->search_id << std::endl; + std::cout << "The index type for this entry is: " << i->category << std::endl; + } + + if(use_section_names && (simple_title != i->term)) + { + // + // First off insert index entry with primary term + // consisting of the section title, and secondary term the + // actual index term, this gets skipped if the title and index + // term are the same: + // + if(internal_indexes == false) + { + // Insert an <indexterm> into the XML: + boost::tiny_xml::element_ptr p(new boost::tiny_xml::element()); + p->name = "indexterm"; + boost::tiny_xml::element_ptr prim(new boost::tiny_xml::element()); + prim->name = "primary"; + prim->elements.push_front(boost::tiny_xml::element_ptr(new boost::tiny_xml::element())); + prim->elements.front()->content = simple_title; + p->elements.push_front(prim); + + boost::tiny_xml::element_ptr sec(new boost::tiny_xml::element()); + sec->name = "secondary"; + sec->elements.push_front(boost::tiny_xml::element_ptr(new boost::tiny_xml::element())); + sec->elements.front()->content = i->term; + p->elements.push_back(sec); + try{ + // Insert the Indexterm: + boost::tiny_xml::element_ptr parent(node->parent); + while(!can_contain_indexterm(parent->name.c_str())) + parent = parent->parent.lock(); + parent->elements.push_front(p); + } + catch(const std::exception&) + { + std::cerr << "Unable to find location to insert <indexterm>" << std::endl; + } + } + // Track the entry in our internal index: + index_entry_ptr item1(new index_entry(simple_title)); + index_entry_ptr item2(new index_entry(i->term, *pid)); + index_entry_set::iterator pos = index_entries.insert(item1).first; + (**pos).sub_keys.insert(item2); + } + // + // Now insert another index entry with the index term + // as the primary key, and the section title as the + // secondary key, this one gets assigned to the + // appropriate index category if there is one: + // + bool preferred_term = false; + if(internal_indexes == false) + { + // Insert <indexterm> into the XML: + boost::tiny_xml::element_ptr p2(new boost::tiny_xml::element()); + p2->name = "indexterm"; + if(i->category.size()) + { + p2->attributes.push_back(boost::tiny_xml::attribute("type", i->category)); + } + boost::tiny_xml::element_ptr prim2(new boost::tiny_xml::element()); + prim2->name = "primary"; + prim2->elements.push_front(boost::tiny_xml::element_ptr(new boost::tiny_xml::element())); + prim2->elements.front()->content = i->term; + p2->elements.push_front(prim2); + + boost::tiny_xml::element_ptr sec2(new boost::tiny_xml::element()); + sec2->name = "secondary"; + sec2->elements.push_front(boost::tiny_xml::element_ptr(new boost::tiny_xml::element())); + sec2->elements.front()->content = rtitle; + p2->elements.push_back(sec2); + try{ + // Insert the Indexterm: + boost::tiny_xml::element_ptr parent(node->parent); + while(!can_contain_indexterm(parent->name.c_str())) + { + // If the search text was found in a title then make it a preferred term: + if(parent->name == "title") + preferred_term = true; + parent = parent->parent.lock(); + } + if(preferred_term) + { + boost::tiny_xml::attribute a("significance", "preferred"); + p2->attributes.push_back(a); + } + parent->elements.push_front(p2); + } + catch(const std::exception&) + { + std::cerr << "Unable to find location to insert <indexterm>" << std::endl; + } + } + + // Track the entry in our internal index: + try{ + // figure out if it's preferred or not: + boost::tiny_xml::element_ptr parent(node->parent); + while(!can_contain_indexterm(parent->name.c_str())) + { + // If the search text was found in a title then make it a preferred term: + if(parent->name == "title") + { + preferred_term = true; + } + parent = parent->parent.lock(); + } + } + catch(const std::exception&){} + + index_entry_ptr item3(new index_entry(i->term)); + if(i->category.size()) + item3->category = i->category; + index_entry_ptr item4(new index_entry(rtitle, *pid)); + item4->preferred = preferred_term; + index_entry_set::iterator pos = index_entries.insert(item3).first; + (**pos).sub_keys.insert(item4); + } + } + } + } + // + // Recurse through children, if not done already: + // + if(!flatten) + recurse_through_children(node, &id, &title, flatten || seen); + // + // Process manual index entries last of all: + // + if(node->name == "indexterm") + { + // Track the entry in our internal index: + const std::string* pid = get_current_block_id(&id); + const std::string* attr = find_attr(node, "type"); + const std::string& rtitle = get_current_block_title(&title); + const std::string simple_title = rewrite_title(rtitle, *pid); + index_entry_ptr item1(new index_entry(last_primary, "", attr ? *attr : "")); + index_entry_set* parent = &((*index_entries.insert(item1).first)->sub_keys); + + if(last_secondary.size()) + { + item1.reset(new index_entry(last_secondary, "", attr ? *attr : "")); + parent = &((*parent->insert(item1).first)->sub_keys); + } + if(last_tertiary.size()) + { + item1.reset(new index_entry(last_tertiary, "", attr ? *attr : "")); + parent = &((*parent->insert(item1).first)->sub_keys); + } + item1.reset(new index_entry(simple_title, *pid, attr ? *attr : "")); + parent->insert(item1); + + last_primary = ""; + last_secondary = ""; + last_tertiary = ""; + } +} + +void process_nodes(boost::tiny_xml::element_ptr node) +{ + node_id id = { 0, }; + title_info t = { "", 0 }; + process_node(node, &id, &t); +} + +int main(int argc, char* argv[]) +{ + try{ + + namespace po = boost::program_options; + po::options_description desc("AutoIndex Allowed Options"); + desc.add_options() + ("help", "Print help message") + ("in", po::value<std::string>(), "Set the input XML file.") + ("out", po::value<std::string>(), "Set output input XML file.") + ("scan", po::value<std::string>(), "Scan the specified file for terms to try and index.") + ("script", po::value<std::string>(), "Specifies the script file to use.") + ("no-duplicates", "Prevents duplicate index entries within the same section.") + ("no-section-names", "Suppresses use of section names as index entries.") + ("internal-index", "Causes AutoIndex to generate the index itself, rather than relying on the XSL stylesheets.") + ("verbose", "Turns on verbose mode.") + ("prefix", po::value<std::string>(), "Sets the prefix to be prepended to all file names and paths in the script file.") + ("index-type", po::value<std::string>(), "Sets the XML container type to use the index.") + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + // + // Process arguments: + // + if(vm.count("help")) + { + std::cout << desc; + return 0; + } + if(vm.count("in")) + { + infile = vm["in"].as<std::string>(); + } + else + { + std::cerr << "No input XML file specified" << std::endl; + return 1; + } + if(vm.count("out")) + { + outfile = vm["out"].as<std::string>(); + } + else + { + std::cerr << "No output XML file specified" << std::endl; + return 1; + } + if(vm.count("verbose")) + { + verbose = true; + } + if(vm.count("prefix")) + { + prefix = vm["prefix"].as<std::string>(); + } + if(vm.count("scan")) + { + std::string f = vm["scan"].as<std::string>(); + if(!exists(boost::filesystem::path(f))) + throw std::runtime_error("Error the file requested for scanning does not exist: " + f); + scan_file(f); + } + if(vm.count("script")) + { + process_script(vm["script"].as<std::string>()); + } + if(vm.count("no-duplicates")) + { + no_duplicates = true; + } + if(vm.count("no-section-names")) + { + use_section_names = false; + } + if(vm.count("internal-index")) + { + internal_indexes = true; + } + if(vm.count("index-type")) + { + internal_index_type = vm["index-type"].as<std::string>(); + } + + std::ifstream is(infile.c_str()); + if((0 == is.peek()) || !is.good()) + { + std::cerr << "Unable to open XML data file " << argv[1] << std::endl; + return 1; + } + // + // We need to skip any leading <? and <! elements: + // + std::string header = get_header(is); + boost::tiny_xml::element_ptr xml = boost::tiny_xml::parse(is, ""); + is.close(); + + std::cout << "Indexing " << index_terms.size() << " terms..." << std::endl; + + process_nodes(xml); + + if(internal_indexes) + generate_indexes(); + + std::ofstream os(outfile.c_str()); + os << header << std::endl; + boost::tiny_xml::write(*xml, os); + std::cout << index_entries.size() << " Index entries were created." << std::endl; + + } + catch(boost::exception& e) + { + std::cerr << diagnostic_information(e); + } + catch(const std::exception& e) + { + std::cerr << e.what() << std::endl; + return 1; + } + catch(const std::string& s) + { + std::cerr << s << std::endl; + return 1; + } + + return 0; +} diff --git a/tools/auto_index/src/auto_index.hpp b/tools/auto_index/src/auto_index.hpp new file mode 100644 index 0000000000..255b8575f5 --- /dev/null +++ b/tools/auto_index/src/auto_index.hpp @@ -0,0 +1,137 @@ +// Copyright 2008 John Maddock +// +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_AUTO_INDEX_HPP +#define BOOST_AUTO_INDEX_HPP + +#include <boost/version.hpp> + +#if BOOST_VERSION < 104400 +# error "This tool requires Boost 1.44 or later to build." +#endif + +#define BOOST_FILESYSTEM_VERSION 3 + +#include "tiny_xml.hpp" +#include <boost/regex.hpp> +#include <boost/filesystem.hpp> +#include <boost/algorithm/string/case_conv.hpp> +#include <fstream> +#include <cctype> +#include <map> +#include <set> +#include <sstream> + +struct index_info +{ + std::string term; // The term goes in the index entry + boost::regex search_text; // What to search for when indexing the term. + boost::regex search_id; // What id's this term may be indexed in. + std::string category; // Index category (function, class, macro etc). +}; +inline bool operator < (const index_info& a, const index_info& b) +{ + return (a.term != b.term) ? (a.term < b.term) : (a.category < b.category); +} + + +struct index_entry; +typedef boost::shared_ptr<index_entry> index_entry_ptr; +bool operator < (const index_entry_ptr& a, const index_entry_ptr& b); +typedef std::set<index_entry_ptr> index_entry_set; + +struct index_entry +{ + std::string key; // The index term. + std::string sort_key; // upper case version of term used for sorting. + std::string id; // The id of the block that we will link to. + std::string category; // The category of this entry (function, class, macro etc). + index_entry_set sub_keys; // All our sub-keys. + bool preferred; // This entry is the preferred one for this key + + index_entry() : preferred(false) {} + index_entry(const std::string& k) : key(k), sort_key(k), preferred(false) { boost::to_upper(sort_key); } + index_entry(const std::string& k, const std::string& i) : key(k), sort_key(k), id(i), preferred(false) { boost::to_upper(sort_key); } + index_entry(const std::string& k, const std::string& i, const std::string& c) : key(k), sort_key(k), id(i), category(c), preferred(false) { boost::to_upper(sort_key); } +}; + + +inline bool operator < (const index_entry_ptr& a, const index_entry_ptr& b) +{ + return ((a->sort_key != b->sort_key) ? (a->sort_key < b->sort_key) : (a->category < b->category)); +} + +struct id_rewrite_rule +{ + bool base_on_id; // rewrite the title if "id" matches the section id, otherwise rewrite if title matches "id". + boost::regex id; // regex for the id or title to match + std::string new_name; // either literal string or format string for the new name. + + id_rewrite_rule(const std::string& i, const std::string& n, bool b) + : base_on_id(b), id(i), new_name(n) {} +}; + +struct node_id +{ + const std::string* id; + node_id* prev; +}; + +struct title_info +{ + std::string title; + title_info* prev; +}; + +struct file_scanner +{ + boost::regex scanner, file_name_filter, section_filter; + std::string format_string, type, term_formatter; +}; + +inline bool operator < (const file_scanner & a, const file_scanner& b) +{ + return a.type < b.type; +} + +typedef std::multiset<file_scanner> file_scanner_set_type; + +void process_script(const std::string& script); +void scan_dir(const std::string& dir, const std::string& mask, bool recurse); +void scan_file(const std::string& file); +void generate_indexes(); +const std::string* find_attr(boost::tiny_xml::element_ptr node, const char* name); + +extern file_scanner_set_type file_scanner_set; + +inline void add_file_scanner(const std::string& type, const std::string& scanner, const std::string& format, const std::string& term_formatter, const std::string& id_filter, const std::string& file_filter) +{ + file_scanner s; + s.type = type; + s.scanner = scanner; + s.format_string = format; + s.term_formatter = term_formatter; + if(file_filter.size()) + s.file_name_filter = file_filter; + if(id_filter.size()) + s.section_filter = id_filter; + file_scanner_set.insert(s); +} + +extern std::set<index_info> index_terms; +extern std::set<std::pair<std::string, std::string> > found_terms; +extern bool no_duplicates; +extern bool verbose; +extern index_entry_set index_entries; +extern boost::tiny_xml::element_list indexes; +extern std::list<id_rewrite_rule> id_rewrite_list; +extern bool internal_indexes; +extern std::string prefix; +extern std::string internal_index_type; +extern boost::regex debug; + +#endif diff --git a/tools/auto_index/src/file_scanning.cpp b/tools/auto_index/src/file_scanning.cpp new file mode 100644 index 0000000000..c129db7ab8 --- /dev/null +++ b/tools/auto_index/src/file_scanning.cpp @@ -0,0 +1,495 @@ +// Copyright 2008 John Maddock +// +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "auto_index.hpp" + +bool need_defaults = true; + +void install_default_scanners() +{ + need_defaults = false; + // + // Set the default scanners if they're not defined already: + // + file_scanner s; + s.type = "class_name"; + if(file_scanner_set.find(s) == file_scanner_set.end()) + { + add_file_scanner( + "class_name", // Index type + // Header file scanner regex: + // possibly leading whitespace: + "^[[:space:]]*" + // possible template declaration: + "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" + // class or struct: + "(class|struct)[[:space:]]*" + // leading declspec macros etc: + "(" + "\\<\\w+\\>" + "(" + "[[:blank:]]*\\([^)]*\\)" + ")?" + "[[:space:]]*" + ")*" + // the class name + "(\\<\\w*\\>)[[:space:]]*" + // template specialisation parameters + "(<[^;:{]+>)?[[:space:]]*" + // terminate in { or : + "(\\{|:[^;\\{()]*\\{)", + + "(?:class|struct)[^;{]+\\\\<\\5\\\\>[^;{]+\\\\{", // Format string to create indexing regex. + "\\5", // Format string to create index term. + "", // Filter regex for section id's. + "" // Filter regex for filenames. + ); + } + + s.type = "typedef_name"; + if(file_scanner_set.find(s) == file_scanner_set.end()) + { + add_file_scanner( + "typedef_name", // Index type + "typedef[^;{}#]+?(\\w+)\\s*;", // scanner regex + "typedef[^;]+\\\\<\\1\\\\>\\\\s*;", // Format string to create indexing regex. + "\\1", // Format string to create index term. + "", // Filter regex for section id's. + "" // Filter regex for filenames. + ); + } + + s.type = "macro_name"; + if(file_scanner_set.find(s) == file_scanner_set.end()) + { + add_file_scanner( + "macro_name", // Index type + "^\\s*#\\s*define\\s+(\\w+)", // scanner regex + "\\\\<\\1\\\\>", // Format string to create indexing regex. + "\\1", // Format string to create index term. + "", // Filter regex for section id's. + "" // Filter regex for filenames. + ); + } + + s.type = "function_name"; + if(file_scanner_set.find(s) == file_scanner_set.end()) + { + add_file_scanner( + "function_name", // Index type + "\\w+(?:\\s*<[^>]>)?[\\s&*]+?(\\w+)\\s*(?:BOOST_[[:upper:]_]+\\s*)?\\([^\\)]*\\)\\s*[;{]", // scanner regex + "\\\\<\\\\w+\\\\>(?:\\\\s+<[^>]*>)?[\\\\s&*]+\\\\<\\1\\\\>\\\\s*\\\\([^;{]*\\\\)", // Format string to create indexing regex. + "\\1", // Format string to create index term. + "", // Filter regex for section id's. + "" // Filter regex for filenames. + ); + } +} + +// +// Helper to dump file contents into a std::string: +// +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + if(is.bad()) return; + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} +// +// Helper to convert string from external source into valid XML: +// +std::string escape_to_xml(const std::string& in) +{ + std::string result; + for(std::string::size_type i = 0; i < in.size(); ++i) + { + switch(in[i]) + { + case '&': + result.append("&"); + break; + case '<': + result.append("<"); + break; + case '>': + result.append(">"); + break; + case '"': + result.append("""); + break; + default: + result.append(1, in[i]); + } + } + return result; +} +// +// Scan a source file for things to index: +// +void scan_file(const std::string& file) +{ + if(need_defaults) + install_default_scanners(); + if(verbose) + std::cout << "Scanning file... " << file << std::endl; + std::string text; + std::ifstream is(file.c_str()); + if(!is.peek() || !is.good()) + throw std::runtime_error(std::string("Unable to read from file: ") + file); + load_file(text, is); + + for(file_scanner_set_type::iterator pscan = file_scanner_set.begin(); pscan != file_scanner_set.end(); ++pscan) + { + bool need_debug = false; + if(!debug.empty() && regex_match(pscan->type, ::debug)) + { + need_debug = true; + std::cout << "Processing scanner " << pscan->type << " on file " << file << std::endl; + std::cout << "Scanner regex:" << pscan->scanner << std::endl; + std::cout << "Scanner formatter (search regex):" << pscan->format_string << std::endl; + std::cout << "Scanner formatter (index term):" << pscan->term_formatter << std::endl; + std::cout << "Scanner file name filter:" << pscan->file_name_filter << std::endl; + std::cout << "Scanner section id filter:" << pscan->section_filter << std::endl; + } + if(!pscan->file_name_filter.empty()) + { + if(!regex_match(file, pscan->file_name_filter)) + { + if(need_debug) + { + std::cout << "File failed to match file name filter, this file will be skipped..." << std::endl; + } + continue; // skip this file + } + } + if(verbose && !need_debug) + std::cout << "Scanning for type \"" << (*pscan).type << "\" ... " << std::endl; + boost::sregex_iterator i(text.begin(), text.end(), (*pscan).scanner), j; + while(i != j) + { + try + { + index_info info; + info.term = escape_to_xml(i->format(pscan->term_formatter)); + info.search_text = i->format(pscan->format_string); + info.category = pscan->type; + if(!pscan->section_filter.empty()) + info.search_id = pscan->section_filter; + std::pair<std::set<index_info>::iterator, bool> pos = index_terms.insert(info); + if(pos.second) + { + if(verbose || need_debug) + std::cout << "Indexing " << info.term << " as type " << info.category << std::endl; + if(need_debug) + std::cout << "Search regex will be: \"" << info.search_text << "\"" << + " ID constraint is: \"" << info.search_id << "\"" + << "Found text was: " << i->str() << std::endl; + if(pos.first->search_text != info.search_text) + { + // + // Merge the search terms: + // + const_cast<boost::regex&>(pos.first->search_text) = + "(?:" + pos.first->search_text.str() + ")|(?:" + info.search_text.str() + ")"; + } + if(pos.first->search_id != info.search_id) + { + // + // Merge the ID constraints: + // + const_cast<boost::regex&>(pos.first->search_id) = + "(?:" + pos.first->search_id.str() + ")|(?:" + info.search_id.str() + ")"; + } + } + } + catch(const boost::regex_error& e) + { + std::cerr << "Unable to create regular expression from found index term:\"" + << i->format(pscan->term_formatter) << "\" In file " << file << std::endl; + std::cerr << e.what() << std::endl; + } + catch(const std::exception& e) + { + std::cerr << "Unable to create index term:\"" + << i->format(pscan->term_formatter) << "\" In file " << file << std::endl; + std::cerr << e.what() << std::endl; + throw; + } + ++i; + } + } +} +// +// Scan a whole directory for files to search: +// +void scan_dir(const std::string& dir, const std::string& mask, bool recurse) +{ + using namespace boost::filesystem; + boost::regex e(mask); + directory_iterator i(dir), j; + + while(i != j) + { + if(regex_match(i->path().filename().string(), e)) + { + scan_file(i->path().string()); + } + else if(recurse && is_directory(i->status())) + { + scan_dir(i->path().string(), mask, recurse); + } + ++i; + } +} +// +// Remove quotes from a string: +// +std::string unquote(const std::string& s) +{ + std::string result(s); + if((s.size() >= 2) && (*s.begin() == '\"') && (*s.rbegin() == '\"')) + { + result.erase(result.begin()); + result.erase(result.end() - 1); + } + return result; +} +// +// Load and process a script file: +// +void process_script(const std::string& script) +{ + static const boost::regex comment_parser( + "\\s*(?:#.*)?$" + ); + static const boost::regex scan_parser( + "!scan[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s*" + ); + static const boost::regex scan_dir_parser( + "!scan-path[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" + "[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" + "(?:" + "[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" + ")?\\s*" + ); + static const boost::regex entry_parser( + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" + "(?:" + "[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)*\")" + "(?:" + "[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)*\")" + "(?:" + "[[:space:]]+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)*\")" + ")?" + ")?" + ")?" + "[[:space:]]*"); + static const boost::regex rewrite_parser( + "!(rewrite-name|rewrite-id)\\s+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s*" + ); + static const boost::regex debug_parser( + "!debug\\s+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s*" + ); + static const boost::regex define_scanner_parser( + "!define-scanner\\s+" + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s+" // type, index 1 + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s+" // scanner regex, index 2 + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")\\s+" // format string, index 3 + "([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" // format string for name, index 4 + "(?:" + "\\s+([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" // id-filter, index 5 + "(?:" + "\\s+([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")" // filename-filter, index 6 + ")?" + ")?" + "\\s*" + ); + static const boost::regex error_parser("!.*"); + + if(verbose) + std::cout << "Processing script " << script << std::endl; + boost::smatch what; + std::string line; + std::ifstream is(script.c_str()); + if(is.bad() || !exists(boost::filesystem::path(script))) + { + throw std::runtime_error(std::string("Could not open script file: ") + script); + } + while(std::getline(is, line).good()) + { + if(regex_match(line, what, comment_parser)) + { + // Nothing to do here... + } + else if(regex_match(line, what, scan_parser)) + { + std::string f = unquote(what[1].str()); + if(!boost::filesystem::path(f).is_complete()) + { + if(prefix.size()) + { + boost::filesystem::path base(prefix); + base /= f; + f = base.string(); + } + else + { + boost::filesystem::path base(script); + base.remove_filename(); + base /= f; + f = base.string(); + } + } + if(!exists(boost::filesystem::path(f))) + throw std::runtime_error("Error the file requested for scanning does not exist: " + f); + scan_file(f); + } + else if(regex_match(line, what, debug_parser)) + { + debug = unquote(what[1].str()); + } + else if(regex_match(line, what, define_scanner_parser)) + { + add_file_scanner(unquote(what.str(1)), unquote(what.str(2)), unquote(what.str(3)), + unquote(what.str(4)), unquote(what.str(5)), unquote(what.str(6))); + } + else if(regex_match(line, what, scan_dir_parser)) + { + std::string d = unquote(what[1].str()); + std::string m = unquote(what[2].str()); + bool r = unquote(what[3].str()) == "true"; + if(!boost::filesystem::path(d).is_complete()) + { + if(prefix.size()) + { + boost::filesystem::path base(prefix); + base /= d; + d = base.string(); + } + else + { + boost::filesystem::path base(script); + base.remove_filename(); + base /= d; + d = base.string(); + } + } + if(verbose) + std::cout << "Scanning directory " << d << std::endl; + if(!exists(boost::filesystem::path(d))) + throw std::runtime_error("Error the path requested for scanning does not exist: " + d); + scan_dir(d, m, r); + } + else if(regex_match(line, what, rewrite_parser)) + { + bool id = what[1] == "rewrite-id"; + std::string a = unquote(what[2].str()); + std::string b = unquote(what[3].str()); + id_rewrite_list.push_back(id_rewrite_rule(a, b, id)); + } + else if(line.compare(0, 9, "!exclude ") == 0) + { + static const boost::regex delim("([^\"[:space:]]+|\"(?:[^\"\\\\]|\\\\.)+\")"); + boost::sregex_token_iterator i(line.begin() + 9, line.end(), delim, 0), j; + while(i != j) + { + index_info info; + info.term = escape_to_xml(unquote(*i)); + // Erase all entries that have a category in our scanner set, + // plus any entry with no category at all: + index_terms.erase(info); + for(file_scanner_set_type::iterator pscan = file_scanner_set.begin(); pscan != file_scanner_set.end(); ++pscan) + { + info.category = (*pscan).type; + index_terms.erase(info); + } + ++i; + } + } + else if(regex_match(line, error_parser)) + { + std::cerr << "Error: Unable to process line: " << line << std::endl; + } + else if(regex_match(line, what, entry_parser)) + { + try{ + // what[1] is the Index entry + // what[2] is the regex to search for (optional) + // what[3] is a section id that must be matched + // in order for the term to be indexed (optional) + // what[4] is the index category to place the term in (optional). + index_info info; + info.term = escape_to_xml(unquote(what.str(1))); + std::string s = unquote(what.str(2)); + if(s.size()) + info.search_text = boost::regex(s, boost::regex::icase|boost::regex::perl); + else + info.search_text = boost::regex("\\<" + what.str(1) + "\\>", boost::regex::icase|boost::regex::perl); + + s = unquote(what.str(3)); + if(s.size()) + info.search_id = s; + if(what[4].matched) + info.category = unquote(what.str(4)); + std::pair<std::set<index_info>::iterator, bool> pos = index_terms.insert(info); + if(pos.second) + { + if(pos.first->search_text != info.search_text) + { + // + // Merge the search terms: + // + const_cast<boost::regex&>(pos.first->search_text) = + "(?:" + pos.first->search_text.str() + ")|(?:" + info.search_text.str() + ")"; + } + if(pos.first->search_id != info.search_id) + { + // + // Merge the ID constraints: + // + const_cast<boost::regex&>(pos.first->search_id) = + "(?:" + pos.first->search_id.str() + ")|(?:" + info.search_id.str() + ")"; + } + } + } + catch(const boost::regex_error&) + { + std::cerr << "Unable to process regular expression in script line:\n \"" + << line << "\"" << std::endl; + throw; + } + catch(const std::exception&) + { + std::cerr << "Unable to process script line:\n \"" + << line << "\"" << std::endl; + throw; + } + } + else + { + std::cerr << "Error: Unable to process line: " << line << std::endl; + } + } +} + diff --git a/tools/auto_index/src/index_generator.cpp b/tools/auto_index/src/index_generator.cpp new file mode 100644 index 0000000000..1b65f63c9a --- /dev/null +++ b/tools/auto_index/src/index_generator.cpp @@ -0,0 +1,327 @@ +// Copyright 2008 John Maddock +// +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "auto_index.hpp" +#include <boost/range.hpp> +#include <boost/format.hpp> + +// +// Get a numerical ID for the next item: +// +std::string get_next_index_id() +{ + static int index_id_count = 0; + std::stringstream s; + s << "idx_id_" << index_id_count; + ++index_id_count; + return s.str(); +} + +void raise_invalid_xml(const std::string& parent, const std::string& child) +{ + throw std::runtime_error("Error: element " + child + " can not appear inside the container " + parent + ": try using a different value for property \"auto-index-type\"."); +} +// +// Validate that the container for the Index is in a valid place: +// +void check_index_type_and_placement(const std::string& parent, const std::string& container) +{ + if(container == "section") + { + if((parent != "appendix") + && (parent != "article") + && (parent != "chapter") + && (parent != "partintro") + && (parent != "preface") + && (parent != "section")) + raise_invalid_xml(parent, container); + } + else if(container == "appendix") + { + if((parent != "article") + && (parent != "book") + && (parent != "part")) + raise_invalid_xml(parent, container); + } + else if(container == "index") + { + if((parent != "appendix") + && (parent != "article") + && (parent != "book") + && (parent != "chapter") + && (parent != "part") + && (parent != "preface") + && (parent != "sect1") + && (parent != "sect2") + && (parent != "sect3") + && (parent != "sect4") + && (parent != "sect5") + && (parent != "section") + ) + raise_invalid_xml(parent, container); + } + else if((container == "article") || (container == "chapter") || (container == "reference")) + { + if((parent != "book") + && (parent != "part")) + raise_invalid_xml(parent, container); + } + else if(container == "part") + { + if(parent != "book") + raise_invalid_xml(parent, container); + } + else if(container == "refsect1") + { + if(parent != "refentry") + raise_invalid_xml(parent, container); + } + else if(container == "refsect2") + { + if(parent != "refsect1") + raise_invalid_xml(parent, container); + } + else if(container == "refsect3") + { + if(parent != "refsect2") + raise_invalid_xml(parent, container); + } + else if(container == "refsection") + { + if((parent != "refsection") && (parent != "refentry")) + raise_invalid_xml(parent, container); + } + else if(container == "sect1") + { + if((parent != "appendix") + && (parent != "article") + && (parent != "chapter") + && (parent != "partintro") + && (parent != "preface") + ) + raise_invalid_xml(parent, container); + } + else if(container == "sect2") + { + if(parent != "sect1") + raise_invalid_xml(parent, container); + } + else if(container == "sect3") + { + if(parent != "sect2") + raise_invalid_xml(parent, container); + } + else if(container == "sect4") + { + if(parent != "sect3") + raise_invalid_xml(parent, container); + } + else if(container == "sect5") + { + if(parent != "sect4") + raise_invalid_xml(parent, container); + } + else + { + throw std::runtime_error("Error: element " + container + " is unknown, and can not be used as a container for an index: try using a different value for property \"auto-index-type\"."); + } +} + +boost::tiny_xml::element_ptr make_element(const std::string& name) +{ + boost::tiny_xml::element_ptr result(new boost::tiny_xml::element); + result->name = name; + return result; +} + +boost::tiny_xml::element_ptr add_attribute(boost::tiny_xml::element_ptr ptr, const std::string& name, const std::string& value) +{ + boost::tiny_xml::attribute attr; + attr.name = name; + attr.value = value; + ptr->attributes.push_back(attr); + return ptr; +} + +boost::regex make_primary_key_matcher(const std::string& s) +{ + static const boost::regex e("[-_[:space:]]+|([.\\[{}()\\*+?|^$])"); + static const char* format = "(?1\\\\$1:[-_[:space:]]+)"; + return boost::regex(regex_replace(s, e, format, boost::regex_constants::format_all), boost::regex::icase|boost::regex::perl); +} + +// +// Generate an index entry using our own internal method: +// +template <class Range> +boost::tiny_xml::element_ptr generate_entry(const Range& range, const std::string* pcategory, int level = 0, const boost::regex* primary_key = 0) +{ + boost::tiny_xml::element_ptr list = add_attribute(add_attribute(::add_attribute(make_element("itemizedlist"), "mark", "none"), "spacing", "compact"), "role", "index"); + + for(typename boost::range_iterator<Range>::type i = boost::begin(range); i != boost::end(range);) + { + std::string key = (*i)->key; + index_entry_set entries; + bool preferred = false; + std::string id; + bool collapse = false; + + // + // Create a regular expression for comparing key to other key's: + // + boost::regex key_regex; + if(level == 0) + { + key_regex = make_primary_key_matcher(key); + primary_key = &key_regex; + } + // + // Begin by consolidating entries with identical keys but possibly different categories: + // + while((i != boost::end(range)) && ((*i)->key == key)) + { + if((0 == pcategory) || (pcategory->size() == 0) || (pcategory && (**i).category == *pcategory)) + { + entries.insert((*i)->sub_keys.begin(), (*i)->sub_keys.end()); + if((*i)->preferred) + preferred = true; + if((*i)->id.size()) + { + if(id.size()) + { + std::cerr << "WARNING: two identical index terms have different link destinations!!" << std::endl; + } + id = (*i)->id; + } + } + ++i; + } + // + // Only actually generate content if we have anything in the entries set: + // + if(entries.size() || id.size()) + { + // + // See if we can collapse any sub-entries into this one: + // + if(entries.size() == 1) + { + if((regex_match((*entries.begin())->key, *primary_key) || ((*entries.begin())->key == key)) + && ((*entries.begin())->id.size()) + && ((*entries.begin())->id != id)) + { + collapse = true; + id = (*entries.begin())->id; + } + } + // + // See if this key is the same as the primary key, if it is then make it prefered: + // + if(level && regex_match(key, *primary_key)) + { + preferred = true; + } + boost::tiny_xml::element_ptr item = make_element("listitem"); + boost::tiny_xml::element_ptr para = make_element("para"); + item->elements.push_back(para); + list->elements.push_back(item); + if(preferred) + { + para->elements.push_back(add_attribute(make_element("emphasis"), "role", "bold")); + para = para->elements.back(); + } + if(id.size()) + { + boost::tiny_xml::element_ptr link = add_attribute(make_element("link"), "linkend", id); + para->elements.push_back(link); + para = link; + } + std::string classname = (boost::format("index-entry-level-%1%") % level).str(); + para->elements.push_back(add_attribute(make_element("phrase"), "role", classname)); + para = para->elements.back(); + para->content = key; + if(!collapse && entries.size()) + { + std::pair<index_entry_set::const_iterator, index_entry_set::const_iterator> subrange(entries.begin(), entries.end()); + item->elements.push_back(generate_entry(subrange, 0, level+1, primary_key)); + } + } + } + return list; +} +// +// Generate indexes using our own internal method: +// +void generate_indexes() +{ + for(boost::tiny_xml::element_list::const_iterator i = indexes.begin(); i != indexes.end(); ++i) + { + boost::tiny_xml::element_ptr node = *i; + const std::string* category = find_attr(node, "type"); + bool has_title = false; + + for(boost::tiny_xml::element_list::const_iterator k = (*i)->elements.begin(); k != (*i)->elements.end(); ++k) + { + if((**k).name == "title") + { + has_title = true; + break; + } + } + + boost::tiny_xml::element_ptr navbar = make_element("para"); + node->elements.push_back(navbar); + + index_entry_set::const_iterator m = index_entries.begin(); + index_entry_set::const_iterator n = m; + boost::tiny_xml::element_ptr vlist = make_element("variablelist"); + node->elements.push_back(vlist); + while(n != index_entries.end()) + { + char current_letter = std::toupper((*n)->key[0]); + std::string id_name = get_next_index_id(); + boost::tiny_xml::element_ptr entry = add_attribute(make_element("varlistentry"), "id", id_name); + boost::tiny_xml::element_ptr term = make_element("term"); + term->content = std::string(1, current_letter); + entry->elements.push_back(term); + boost::tiny_xml::element_ptr item = make_element("listitem"); + entry->elements.push_back(item); + while((n != index_entries.end()) && (std::toupper((*n)->key[0]) == current_letter)) + ++n; + std::pair<index_entry_set::const_iterator, index_entry_set::const_iterator> range(m, n); + item->elements.push_back(generate_entry(range, category)); + if(item->elements.size() && (*item->elements.begin())->elements.size()) + { + vlist->elements.push_back(entry); + boost::tiny_xml::element_ptr p = make_element(""); + p->content = " "; + if(navbar->elements.size()) + { + navbar->elements.push_back(p); + } + p = add_attribute(make_element("link"), "linkend", id_name); + p->content = current_letter; + navbar->elements.push_back(p); + } + m = n; + } + + node->name = internal_index_type; + boost::tiny_xml::element_ptr p(node->parent); + while(p->name.empty()) + p = boost::tiny_xml::element_ptr(p->parent); + check_index_type_and_placement(p->name, node->name); + node->attributes.clear(); + if(!has_title) + { + boost::tiny_xml::element_ptr t = make_element("title"); + t->content = "Index"; + node->elements.push_front(t); + } + } +} + diff --git a/tools/auto_index/src/tiny_xml.cpp b/tools/auto_index/src/tiny_xml.cpp new file mode 100644 index 0000000000..81b3b26d9d --- /dev/null +++ b/tools/auto_index/src/tiny_xml.cpp @@ -0,0 +1,257 @@ +// tiny XML sub-set tools implementation -----------------------------------// + +// (C) Copyright Beman Dawes 2002. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "tiny_xml.hpp" +#include <cassert> +#include <cstring> + +namespace +{ + + inline void eat_whitespace( char & c, std::istream & in ) + { + while ( c == ' ' || c == '\r' || c == '\n' || c == '\t' ) + in.get( c ); + } + + void eat_comment( char & c, std::istream & in ) + { + in.get(c); + if(c != '-') + throw std::string("Invalid comment in XML"); + in.get(c); + if(c != '-') + throw std::string("Invalid comment in XML"); + do{ + while(in.get(c) && (c != '-')); + in.get(c); + if(c != '-') + continue; + in.get(c); + if(c != '>') + continue; + else + break; + } + while(true); + } + + std::string get_name( char & c, std::istream & in ) + { + std::string result; + eat_whitespace( c, in ); + while ( std::strchr( + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.:", c ) + != 0 ) + { + result += c; + if(!in.get( c )) + throw std::string("xml: unexpected eof"); + } + return result; + } + + void eat_delim( char & c, std::istream & in, + char delim, const std::string & msg ) + { + eat_whitespace( c, in ); + if ( c != delim ) + throw std::string("xml syntax error, expected ") + delim + + " (" + msg + ")"; + in.get( c ); + } + + std::string get_value( char & c, std::istream & in ) + { + std::string result; + while ( c != '\"' ) + { + result += c; + in.get( c ); + } + in.get( c ); + return result; + } + +} + +namespace boost +{ + namespace tiny_xml + { + + // parse -----------------------------------------------------------------// + + element_ptr parse( std::istream & in, const std::string & msg ) + { + char c = 0; // current character + element_ptr e( new element ); + + if(!in.get( c )) + throw std::string("xml: unexpected eof"); + if ( c == '<' ) + if(!in.get( c )) + throw std::string("xml: unexpected eof"); + + if(c == '!') + { + eat_comment(c, in); + return e; + } + if(c == '?') + { + // XML processing instruction. + e->name += c; + if(!in.get( c )) // next char + throw std::string("xml: unexpected eof"); + e->name += get_name(c, in); + in >> std::ws; + if(!in.get( c )) // next char + throw std::string("xml: unexpected eof"); + while(c != '?') + { + e->content += c; + if(!in.get( c )) // next char + throw std::string("xml: unexpected eof"); + } + if(!in.get( c )) // next char + throw std::string("xml: unexpected eof"); + if(c != '>') + throw std::string("Invalid XML processing instruction."); + return e; + } + + e->name = get_name( c, in ); + eat_whitespace( c, in ); + + // attributes + while ( (c != '>') && (c != '/') ) + { + attribute a; + a.name = get_name( c, in ); + + eat_delim( c, in, '=', msg ); + eat_delim( c, in, '\"', msg ); + + a.value = get_value( c, in ); + + e->attributes.push_back( a ); + eat_whitespace( c, in ); + } + if(c == '/') + { + if(!in.get( c )) // next after '/' + throw std::string("xml: unexpected eof"); + eat_whitespace( c, in ); + if(c != '>') + throw std::string("xml: unexpected /"); + return e; + } + if(!in.get( c )) // next after '>' + throw std::string("xml: unexpected eof"); + + //eat_whitespace( c, in ); + + do{ + // sub-elements + while ( c == '<' ) + { + if ( in.peek() == '/' ) + break; + element_ptr child(parse( in, msg )); + child->parent = e; + e->elements.push_back(child); + in.get( c ); // next after '>' + //eat_whitespace( c, in ); + } + if (( in.peek() == '/' ) && (c == '<')) + break; + + // content + if ( (c != '<') ) + { + element_ptr sub( new element ); + while ( c != '<' ) + { + sub->content += c; + if(!in.get( c )) + throw std::string("xml: unexpected eof"); + } + sub->parent = e; + e->elements.push_back( sub ); + } + + assert( c == '<' ); + if( in.peek() == '/' ) + break; + }while(true); + + in.get(c); + eat_delim( c, in, '/', msg ); + std::string end_name( get_name( c, in ) ); + if ( e->name != end_name ) + throw std::string("xml syntax error: beginning name ") + + e->name + " did not match end name " + end_name + + " (" + msg + ")"; + + eat_delim( c, in, '>', msg ); + if(c != '>') + { + // we've eaten one character past the >, put it back: + if(!in.putback(c)) + throw std::string("Unable to put back character"); + } + return e; + } + + // write ---------------------------------------------------------------// + + void write( const element & e, std::ostream & out ) + { + if(e.name.size()) + { + out << "<" << e.name; + if ( !e.attributes.empty() ) + { + for( attribute_list::const_iterator itr = e.attributes.begin(); + itr != e.attributes.end(); ++itr ) + { + out << " " << itr->name << "=\"" << itr->value << "\""; + } + } + if(e.name[0] == '?') + { + out << " " << e.content << "?>"; + return; + } + if(e.elements.empty() && e.content.empty()) + { + out << "/>"; + return; + } + out << ">"; + } + if ( !e.elements.empty() ) + { + for( element_list::const_iterator itr = e.elements.begin(); + itr != e.elements.end(); ++itr ) + { + write( **itr, out ); + } + } + if ( !e.content.empty() ) + { + out << e.content; + } + if(e.name.size() && (e.name[0] != '?')) + { + out << "</" << e.name << ">"; + } + } + + } // namespace tiny_xml +} // namespace boost + diff --git a/tools/auto_index/src/tiny_xml.hpp b/tools/auto_index/src/tiny_xml.hpp new file mode 100644 index 0000000000..5ecbd4ce26 --- /dev/null +++ b/tools/auto_index/src/tiny_xml.hpp @@ -0,0 +1,83 @@ +// tiny XML sub-set tools --------------------------------------------------// + +// (C) Copyright Beman Dawes 2002. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// Provides self-contained tools for this XML sub-set: +// +// element ::= { "<" name { name "=" "\"" value "\"" } ">" +// {element} [contents] "</" name ">" } +// +// The point of "self-contained" is to minimize tool-chain dependencies. + +#ifndef BOOST_TINY_XML_H +#define BOOST_TINY_XML_H + +#include "boost/smart_ptr.hpp" // for shared_ptr +#include "boost/utility.hpp" // for noncopyable +#include <list> +#include <iostream> +#include <string> + +namespace boost +{ + namespace tiny_xml + { + class element; + struct attribute + { + std::string name; + std::string value; + + attribute(){} + attribute( const std::string & name, const std::string & value ) + : name(name), value(value) {} + }; + typedef boost::shared_ptr< element > element_ptr; + typedef boost::weak_ptr< element > weak_element_ptr; + typedef std::list< element_ptr > element_list; + typedef std::list< attribute > attribute_list; + + class element + : private boost::noncopyable // because deep copy semantics would be required + { + public: + // The name of the XML element, or "" if this is inline content, + // or begins with '?' if this is a processing instruction. + std::string name; + // List of attributes applied to this element + attribute_list attributes; + // List of sub-elements, this will be empty if the name is empty + // or starts with a '?'. Plain text content will be inside + // anonymous elements in this list - this preserves the order of + // plain text mixed with true XML <elements>. + element_list elements; + // The plain text content of this element, only present if the name is "" + // or if this is a processing instruction in which case it is the content + // after the name of the instruction. + std::string content; + // Pointer to our parent + weak_element_ptr parent; + + element() {} + explicit element( const std::string & name ) : name(name) {} + }; + + // Precondition: stream positioned at either the initial "<" + // or the first character after the initial "<". + // Postcondition: stream positioned at the first character after final + // ">" (or eof). + // Returns: an element_ptr to an element representing the parsed stream. + // Throws: std::string on syntax error. msg appended to what() string. + element_ptr parse( std::istream & in, const std::string & msg ); + + void write( const element & e, std::ostream & out ); + + } +} + +#endif // BOOST_TINY_XML_H + + + diff --git a/tools/auto_index/test/Jamfile.v2 b/tools/auto_index/test/Jamfile.v2 new file mode 100644 index 0000000000..4b1e60b567 --- /dev/null +++ b/tools/auto_index/test/Jamfile.v2 @@ -0,0 +1,62 @@ + +import feature ; +import generators ; +import modules ; +import project ; +import targets ; +import testing ; +import toolset ; +import type ; + +alias line_compare_tool : ../../quickbook/test/src//line-compare-tool ; + +rule auto-index-test ( target-name : input-file : output-file ? : options * ) +{ + local project = [ project.current ] ; + + local t = + [ targets.create-typed-target RUN + : $(project) + : $(target-name) + : [ alias autoindex : ../build//auto_index : release ] + : $(requirements) + <location-prefix>$(target-name).test + <testing.arg>--prefix=../../.. + <testing.arg>$(options) + <testing.arg>--in=$(input-file) + <testing.arg>--out=$(target-name).out + <preserve-test-targets>on + <dependency>Jamfile.v2 + <dependency>$(input-file) + ] + ; + + t += + [ targets.create-typed-target RUN + : $(project) + : $(target-name)_check + : .//line_compare_tool + : $(requirements) + <location-prefix>$(target-name).test + <testing.arg>$(target-name).out + <testing.arg>$(target-name).gold + <preserve-test-targets>on + <dependency>$(target_name) + <implicit-dependency>$(target_name) + <dependency>Jamfile.v2 + <dependency>$(input-file) + ] + ; + + modules.poke testing : .all-tests : \$\(all-tests\) $(t) ; + + return $(t) ; +} + +auto-index-test test1 : type_traits.docbook : : --script=index.idx ; +auto-index-test test2 : type_traits.docbook : : --internal-index --script=index.idx ; +auto-index-test test3 : type_traits.docbook : : --internal-index --index-type=index --script=index.idx ; + + + + diff --git a/tools/auto_index/test/index.idx b/tools/auto_index/test/index.idx new file mode 100644 index 0000000000..52507c28a1 --- /dev/null +++ b/tools/auto_index/test/index.idx @@ -0,0 +1,26 @@ + +!define-scanner class_name "BOOST_TT_AUX_TYPE_TRAIT_DEF\d\s*\(\s*(\w+)\s*[,)]" "(?:class|struct)[^;{]+\\<\1\\>[^;{]+\\{" \1 +!define-scanner class_name "BOOST_TT_AUX_BOOL_TRAIT_DEF\d\s*\(\s*(\w+)\s*[,)]" "(?:class|struct)[^;{]+\\<\1\\>[^;{]+\\{" \1 +!define-scanner class_name "BOOST_TT_AUX_SIZE_T_TRAIT_DEF\d\s*\(\s*(\w+)\s*[,)]" "(?:class|struct)[^;{]+\\<\1\\>[^;{]+\\{" \1 + +!define-scanner class_name "^[[:space:]]*(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\<\w+\>([[:blank:]]*\([^)]*\))?[[:space:]]*)*(\<\w*\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\{|:[^;\{()]*\{)" "(?:class|struct)[^;{]+\\<\5\\>[^;{]+\\{" \5 +!define-scanner typedef_name "typedef[^;{}#]+?(\w+)\s*;" "typedef[^;]+\\<\1\\>\\s*;" "\1" +!define-scanner "macro_name" "^\s*#\s*define\s+(\w+)" "\\<\1\\>" "\1" +!define-scanner "function_name" "\w+\s+(\w+)\s*\([^\)]*\)\s*[;{]" "\\<\\w+\\>\\s+\\<\1\\>\\s*\\([^;{]*\\)\\s*[;{]" "\1" + +!scan-path boost/type_traits .*\.hpp true +!scan boost/aligned_storage.hpp +!scan boost/type_traits.hpp + +!exclude type arg1_type arg2_type arg3_type arg4_type arg5_type B D +!exclude result + +!rewrite-name "(?:A|An|The)\s+(.*)" "\1" + +"Constrained Index Term" add_const "boost_typetraits\.reference.*" class_name +"This term should not appear anywhere because of the ID constraint" strlen "(?!boost_typetraits.background).*" function_name + + +type-traits "" ".*.intro" test_index_1 +type-traits "" ".*.background" test_index_2 + diff --git a/tools/auto_index/test/test1.gold b/tools/auto_index/test/test1.gold new file mode 100644 index 0000000000..b53ba13681 --- /dev/null +++ b/tools/auto_index/test/test1.gold @@ -0,0 +1,6671 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> +<!-- + +This file is based upon the type traits docs, but has had additional XML elements added to it +to ensure complete testing. + +--> + +<chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="boost_typetraits" rev:last-revision="$Date: 2008-11-28 12:41:45 +0000 (Fri, 28 Nov 2008) $"> + <chapterinfo><author> + <firstname>various</firstname> <surname>authors</surname> + </author><copyright> + <year>2000</year> <year>2006</year> <holder>Adobe Systems Inc, David Abrahams, + Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat + Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert + Ramey and Jeremy Siek</holder> + </copyright><legalnotice> + <para> + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) + </para> + </legalnotice></chapterinfo> + <title>Boost.TypeTraits</title> + <para> + A printer-friendly <ulink url="http://svn.boost.org/svn/boost/sandbox/pdf/type_traits/release/type_traits.pdf">PDF + version of this manual is also available</ulink>. + </para> + <section id="boost_typetraits.intro"><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm> + <title><link linkend="boost_typetraits.intro"> Introduction</link></title> + <para> + The Boost type-traits library contains a set of very specific traits classes, + each of which encapsulate a single trait from the C++ type system; for example, + is a type a pointer or a reference type? Or does a type have a trivial constructor, + or a const-qualifier? + </para> + <para> + The type-traits classes share a unified design: each class inherits from a + the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. + </para> + </section> + <section id="boost_typetraits.background"><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="class_name"><primary>remove_extent</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>remove_extent</secondary></indexterm><indexterm type="class_name"><primary>is_pointer</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>is_pointer</secondary></indexterm><indexterm type="class_name"><primary>is_void</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>is_void</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm> + <title><link linkend="boost_typetraits.background"> Background and Tutorial</link></title> + <para> + The following is an updated version of the article "C++ Type traits" + by John Maddock and Steve Cleary that appeared in the October 2000 issue of + <ulink url="http://www.ddj.com">Dr Dobb's Journal</ulink>. + </para> + <para> + Generic programming (writing code which works with any data type meeting a + set of requirements) has become the method of choice for providing reusable + code. However, there are times in generic programming when "generic" + just isn't good enough - sometimes the differences between types are too large + for an efficient generic implementation. This is when the traits technique + becomes important - by encapsulating those properties that need to be considered + on a type by type basis inside a traits class, we can minimize the amount of + code that has to differ from one type to another, and maximize the amount of + generic code. + </para> + <?dbfo keep-together="auto" ?> + <para> + <indexterm> + <primary>Foo1</primary> + </indexterm> + Consider an example: when working with character strings, one common operation + is to determine the length of a null terminated string. Clearly it's possible + to write generic code that can do this, but it turns out that there are much + more efficient methods available: for example, the C library functions <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">strlen</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">wcslen</phrase></computeroutput> + are usually written in assembler, and with suitable hardware support can be + considerably faster than a generic version written in C++. The authors of the + C++ standard library realized this, and abstracted the properties of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">wchar_t</phrase></computeroutput> + into the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput>. + Generic code that works with character strings can simply use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase><phrase role="special"><>::</phrase><phrase role="identifier">length</phrase></computeroutput> to determine the length of a null + terminated string, safe in the knowledge that specializations of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> will use the most appropriate + method available to them. + </para> + <anchor id="boost_typetraits.background.type_traits"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.type_traits">Type Traits</link> + </bridgehead> + <para> + Class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> is a classic + example of a collection of type specific properties wrapped up in a single + class - what Nathan Myers termed a <emphasis>baggage class</emphasis><link linkend="background.references">[1]</link>. In the Boost type-traits library, + we<link linkend="background.references">[2]</link> have written a set of very + specific traits classes, each of which encapsulate a single trait from the + C++ type system; for example, is a type a pointer or a reference type? Or does + a type have a trivial constructor, or a const-qualifier? The type-traits classes + share a unified design: each class inherits from a the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. As we will show, these classes can be used in generic programming + to determine the properties of a given type and introduce optimizations that + are appropriate for that case. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. All of the type-traits classes are + defined inside namespace <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase></computeroutput>; + for brevity, namespace-qualification is omitted in most of the code samples + given. + </para> + <anchor id="boost_typetraits.background.implementation"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.implementation">Implementation</link> + </bridgehead> + <para> + There are far too many separate classes contained in the type-traits library + to give a full implementation here - see the source code in the Boost library + for the full details - however, most of the implementation is fairly repetitive + anyway, so here we will just give you a flavor for how some of the classes + are implemented. Beginning with possibly the simplest class in the library, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput> inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + only if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + Here we define a primary version of the template class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_void">is_void</link></computeroutput>, + and provide a full-specialization when <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. While full specialization + of a template class is an important technique, sometimes we need a solution + that is halfway between a fully generic solution, and a full specialization. + This is exactly the situation for which the standards committee defined partial + template-class specialization. As an example, consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>: + here we needed a primary version that handles all the cases where T is not + a pointer, and a partial specialization to handle all the cases where T is + a pointer: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">*></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + The syntax for partial specialization is somewhat arcane and could easily occupy + an article in its own right; like full specialization, in order to write a + partial specialization for a class, you must first declare the primary template. + The partial specialization contains an extra <...> after the class name + that contains the partial specialization parameters; these define the types + that will bind to that partial specialization rather than the default template. + The rules for what can appear in a partial specialization are somewhat convoluted, + but as a rule of thumb if you can legally write two function overloads of the + form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">);</phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">U</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Then you can also write a partial specialization of the form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + This rule is by no means foolproof, but it is reasonably simple to remember + and close enough to the actual rule to be useful for everyday use. + </para> + <para> + As a more complex example of partial specialization consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>. This + class defines a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the same type as T but with any top-level array bounds removed; this + is an example of a traits class that performs a transformation on a type: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">[</phrase><phrase role="identifier">N</phrase><phrase role="special">]></phrase> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + The aim of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + is this: imagine a generic algorithm that is passed an array type as a template + parameter, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + provides a means of determining the underlying type of the array. For example + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">][</phrase><phrase role="number">5</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> would evaluate to the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">5</phrase><phrase role="special">]</phrase></computeroutput>. This example also shows that the number of + template parameters in a partial specialization does not have to match the + number in the default template. However, the number of parameters that appear + after the class name do have to match the number and type of the parameters + in the default template. + </para> + <anchor id="boost_typetraits.background.optimized_copy"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.optimized_copy">Optimized copy</link> + </bridgehead> + <para> + As an example of how the type traits classes can be used, consider the standard + library algorithm copy: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">Iter1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Iter2</phrase><phrase role="special">></phrase> +<phrase role="identifier">Iter2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">Iter1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter2</phrase> <phrase role="identifier">out</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Obviously, there's no problem writing a generic version of copy that works + for all iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput>; however, there are + some circumstances when the copy operation can best be performed by a call + to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. In order to implement + copy in terms of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> all + of the following conditions need to be met: + </para> + <itemizedlist> + <listitem> + Both of the iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must be pointers. + </listitem> + <listitem> + Both <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must point to the same type - excluding + const and volatile-qualifiers. + </listitem> + <listitem> + The type pointed to by <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + must have a trivial assignment operator. + </listitem> + </itemizedlist> + <para> + By trivial assignment operator we mean that the type is either a scalar type<link linkend="background.references">[3]</link> or: + </para> + <itemizedlist> + <listitem> + The type has no user defined assignment operator. + </listitem> + <listitem> + The type does not have any data members that are references. + </listitem> + <listitem> + All base classes, and all data member objects must have trivial assignment + operators. + </listitem> + </itemizedlist> + <para> + If all these conditions are met then a type can be copied using <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> rather than using a compiler generated + assignment operator. The type-traits library provides a class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>, + such that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is true only if T has a trivial assignment + operator. This class "just works" for scalar types, but has to be + explicitly specialised for class/struct types that also happen to have a trivial + assignment operator. In other words if <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + gives the wrong answer, it will give the "safe" wrong answer - that + trivial assignment is not allowable. + </para> + <para> + The code for an optimized version of copy that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + where appropriate is given in <link linkend="boost_typetraits.examples.copy">the + examples</link>. The code begins by defining a template function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">do_copy</phrase></computeroutput> that performs a "slow but safe" + copy. The last parameter passed to this function may be either a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + or a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>. + Following that there is an overload of do<emphasis role="underline">copy that + uses `memcpy`: this time the iterators are required to actually be pointers + to the same type, and the final parameter must be a `</emphasis>_true_type<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">.</phrase> <phrase role="identifier">Finally</phrase><phrase role="special">,</phrase> <phrase role="identifier">the</phrase> <phrase role="identifier">version</phrase> + <phrase role="identifier">of</phrase> </computeroutput>copy<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="identifier">calls</phrase> + </computeroutput>do<emphasis role="underline">copy`, passing `</emphasis>_has_trivial_assign<value_type>()` + as the final parameter: this will dispatch to the optimized version where appropriate, + otherwise it will call the "slow but safe version". + </para> + <anchor id="boost_typetraits.background.was_it_worth_it_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.was_it_worth_it_">Was it worth it?</link> + </bridgehead> + <para> + It has often been repeated in these columns that "premature optimization + is the root of all evil" <link linkend="background.references">[4]</link>. + So the question must be asked: was our optimization premature? To put this + in perspective the timings for our version of copy compared a conventional + generic copy<link linkend="background.references">[5]</link> are shown in table + 1. + </para> + <para> + Clearly the optimization makes a difference in this case; but, to be fair, + the timings are loaded to exclude cache miss effects - without this accurate + comparison between algorithms becomes difficult. However, perhaps we can add + a couple of caveats to the premature optimization rule: + </para> + <itemizedlist> + <listitem> + If you use the right algorithm for the job in the first place then optimization + will not be required; in some cases, memcpy is the right algorithm. + </listitem> + <listitem> + If a component is going to be reused in many places by many people then optimizations + may well be worthwhile where they would not be so for a single case - in + other words, the likelihood that the optimization will be absolutely necessary + somewhere, sometime is that much higher. Just as importantly the perceived + value of the stock implementation will be higher: there is no point standardizing + an algorithm if users reject it on the grounds that there are better, more + heavily optimized versions available. + </listitem> + </itemizedlist> + <table frame="all"> <title>Time taken to copy 1000 elements using `copy<const + T*, T*>` (times in micro-seconds)</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Version + </para> + </entry><entry> + <para> + T + </para> + </entry><entry> + <para> + Time + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 0.99 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 8.07 + </para> + </entry> + </row> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 2.52 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 8.02 + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <anchor id="boost_typetraits.background.pair_of_references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.pair_of_references">Pair of References</link> + </bridgehead> + <para> + The optimized copy example shows how type traits may be used to perform optimization + decisions at compile-time. Another important usage of type traits is to allow + code to compile that otherwise would not do so unless excessive partial specialization + is used. This is possible by delegating partial specialization to the type + traits classes. Our example for this form of usage is a pair that can hold + references <link linkend="background.references">[6]</link>. + </para> + <para> + First, let us examine the definition of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput>, omitting + the comparison operators, default constructor, and template copy constructor + for simplicity: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Now, this "pair" cannot hold references as it currently stands, because + the constructor would require taking a reference to a reference, which is currently + illegal <link linkend="background.references">[7]</link>. Let us consider what + the constructor's parameters would have to be in order to allow "pair" + to hold non-reference types, references, and constant references: + </para> + <table frame="all"> <title>Required Constructor Argument Types</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of parameter to initializing constructor + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + A little familiarity with the type traits classes allows us to construct a + single mapping that allows us to determine the type of parameter from the type + of the contained class. The type traits classes provide a transformation <link linkend="boost_typetraits.reference.add_reference">add_reference</link>, which + adds a reference to its type, unless it is already a reference. + </para> + <table frame="all"> <title>Using add_reference to synthesize the correct constructor + type</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & [8] + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + This allows us to build a primary template definition for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> + that can contain non-reference types, reference types, and constant reference + types: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> + <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Add back in the standard comparison operators, default constructor, and template + copy constructor (which are all the same), and you have a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput> that + can hold reference types! + </para> + <para> + This same extension could have been done using partial template specialization + of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>, but to specialize + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> in this way would require + three partial specializations, plus the primary template. Type traits allows + us to define a single primary template that adjusts itself auto-magically to + any of these partial specializations, instead of a brute-force partial specialization + approach. Using type traits in this fashion allows programmers to delegate + partial specialization to the type traits classes, resulting in code that is + easier to maintain and easier to understand. + </para> + <anchor id="boost_typetraits.background.conclusion"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.conclusion">Conclusion</link> + </bridgehead> + <para> + We hope that in this article we have been able to give you some idea of what + type-traits are all about. A more complete listing of the available classes + are in the boost documentation, along with further examples using type traits. + Templates have enabled C++ uses to take the advantage of the code reuse that + generic programming brings; hopefully this article has shown that generic programming + does not have to sink to the lowest common denominator, and that templates + can be optimal as well as generic. + </para> + <anchor id="boost_typetraits.background.acknowledgements"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.acknowledgements">Acknowledgements</link> + </bridgehead> + <para> + The authors would like to thank Beman Dawes and Howard Hinnant for their helpful + comments when preparing this article. + </para> + <anchor id="background.references"/> <anchor id="boost_typetraits.background.references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.references">References</link> + </bridgehead> + <orderedlist inheritnum="ignore" continuation="restarts"> + <listitem> + Nathan C. Myers, C++ Report, June 1995. + </listitem> + <listitem> + The type traits library is based upon contributions by Steve Cleary, Beman + Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org. + </listitem> + <listitem> + A scalar type is an arithmetic type (i.e. a built-in integer or floating + point type), an enumeration type, a pointer, a pointer to member, or a const- + or volatile-qualified version of one of these types. + </listitem> + <listitem> + This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg + 268. + </listitem> + <listitem> + The test code is available as part of the boost utility library (see algo_opt_examples.cpp), + the code was compiled with gcc 2.95 with all optimisations turned on, tests + were conducted on a 400MHz Pentium II machine running Microsoft Windows 98. + </listitem> + <listitem> + John Maddock and Howard Hinnant have submitted a "compressed_pair" + library to Boost, which uses a technique similar to the one described here + to hold references. Their pair also uses type traits to determine if any + of the types are empty, and will derive instead of contain to conserve space + -- hence the name "compressed". + </listitem> + <listitem> + This is actually an issue with the C++ Core Language Working Group (issue + #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow + a "reference to a reference to T" to mean the same thing as a "reference + to T", but only in template instantiation, in a method similar to multiple + cv-qualifiers. + </listitem> + <listitem> + For those of you who are wondering why this shouldn't be const-qualified, + remember that references are always implicitly constant (for example, you + can't re-assign a reference). Remember also that "const T &" + is something completely different. For this reason, cv-qualifiers on template + type arguments that are references are ignored. + </listitem> + </orderedlist> + </section> + <section id="boost_typetraits.category"> + <title><link linkend="boost_typetraits.category"> Type Traits by Category</link></title> + <section id="boost_typetraits.category.value_traits"> + <title><link linkend="boost_typetraits.category.value_traits"> Type Traits + that Describe the Properties of a Type</link></title> + <para> + <indexterm> + <primary>Foo2</primary> + <secondary>Bar2</secondary> + </indexterm> + These traits are all <emphasis>value traits</emphasis>, which is to say the + traits classes all inherit from <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link>, + and are used to access some numerical property of a type. Often this is a + simple true or false Boolean value, but in a few cases may be some other + integer value (for example when dealing with type alignments, or array bounds: + see <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.alignment_of">alignment_of</link></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.rank">rank</link></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.extent">extent</link></computeroutput>). + </para> + <section id="boost_typetraits.category.value_traits.primary"> + <title><link linkend="boost_typetraits.category.value_traits.primary"> Categorizing + a Type</link></title> + <para> + These traits identify what "kind" of type some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is. These are split into two groups: + primary traits which are all mutually exclusive, and composite traits that + are compositions of one or more primary traits. + </para> + <para> + For any given type, exactly one primary type trait will inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + and all the others will inherit from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + in other words these traits are mutually exclusive. + </para> + <para> + This means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + will only ever be true for built-in types; if you want to check for a user-defined + class type that behaves "as if" it is an integral or floating + point type, then use the <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric_limits</phrase> + <phrase role="keyword">template</phrase></computeroutput> instead. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_array">is_array</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_complex">is_complex</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_enum">is_enum</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">;</phrase> +</programlisting> + <para> + The following traits are made up of the union of one or more type categorizations. + A type may belong to more than one of these categories, in addition to + one of the primary categories. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_arithmetic">is_arithmetic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_compound">is_compound</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_object">is_object</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_scalar">is_scalar</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.properties"> + <title><link linkend="boost_typetraits.category.value_traits.properties"> + General Type Properties</link></title> + <para> + The following templates describe the general properties of a type. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.alignment_of">alignment_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_abstract">is_abstract</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_const">is_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_empty">is_empty</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_signed">is_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_unsigned">is_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_volatile">is_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.extent">extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.relate"> + <title><link linkend="boost_typetraits.category.value_traits.relate"> Relationships + Between Two Types</link></title> + <para> + These templates determine the whether there is a relationship between two + types: + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_base_of">is_base_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.category.transform"><indexterm type="macro_name"><primary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</primary><secondary>Type Traits that Transform One Type to Another</secondary></indexterm><indexterm><primary>Type Traits that Transform One Type to Another</primary><secondary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</primary><secondary>Type Traits that Transform One Type to Another</secondary></indexterm><indexterm><primary>Type Traits that Transform One Type to Another</primary><secondary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</secondary></indexterm> + <title><link linkend="boost_typetraits.category.transform"> Type Traits that + Transform One Type to Another</link></title> + <para> + The following templates transform one type to another, based upon some well-defined + rule. Each template has a single member called <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of applying the transformation to the template argument + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_const">add_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_cv">add_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_pointer">add_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_volatile">add_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.decay">decay</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_signed">make_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_unsigned">make_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.promote">promote</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_all_extents">remove_all_extents</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_const">remove_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_cv">remove_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_reference">remove_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_volatile">remove_volatile</link><phrase role="special">;</phrase> +</programlisting> + <anchor id="boost_typetraits.category.transform.broken_compiler_workarounds_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">Broken + Compiler Workarounds:</link> + </bridgehead> + <para> + For all of these templates support for partial specialization of class templates + is required to correctly implement the transformation. On the other hand, + practice shows that many of the templates from this category are very useful, + and often essential for implementing some generic libraries. Lack of these + templates is often one of the major limiting factors in porting those libraries + to compilers that do not yet support this language feature. As some of these + compilers are going to be around for a while, and at least one of them is + very wide-spread, it was decided that the library should provide workarounds + where possible. + </para> + <para> + The basic idea behind the workaround is to manually define full specializations + of all type transformation templates for all fundamental types, and all their + 1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide + a user-level macro that will define all the explicit specializations needed + for any user-defined type T. + </para> + <para> + The first part guarantees the successful compilation of something like this: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="special">...</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +</programlisting> + <para> + and the second part provides the library's users with a mechanism to make + the above code work not only for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> or other built-in type, + but for their own types as well: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">namespace</phrase> <phrase role="identifier">myspace</phrase><phrase role="special">{</phrase> + <phrase role="keyword">struct</phrase> <phrase role="identifier">MyClass</phrase> <phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +<phrase role="comment">// declare this at global scope: +</phrase><phrase role="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase><phrase role="special">(</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">)</phrase> +<phrase role="comment">// transformations on myspace::MyClass now work: +</phrase><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="comment">// etc. +</phrase></programlisting> + <para> + Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates + to nothing on those compilers that <emphasis role="bold">do</emphasis> support + partial specialization. + </para> + </section> + <section id="boost_typetraits.category.alignment"> + <title><link linkend="boost_typetraits.category.alignment"> Synthesizing Types + with Specific Alignments</link></title> + <para> + Some low level memory management routines need to synthesize a POD type with + specific alignment properties. The template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link></computeroutput> + finds the smallest type with a specified alignment, while template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link></computeroutput> + creates a type with a specific size and alignment. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.function"> + <title><link linkend="boost_typetraits.category.function"> Decomposing Function + Types</link></title> + <para> + The class template <link linkend="boost_typetraits.reference.function_traits">function_traits</link> + extracts information from function types (see also <link linkend="boost_typetraits.reference.is_function">is_function</link>). + This traits class allows you to tell how many arguments a function takes, + what those argument types are, and what the return type is. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.function_traits">function_traits</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.user_defined"><indexterm type="class_name"><primary>is_union</primary><secondary>User Defined Specializations</secondary></indexterm><indexterm><primary>User Defined Specializations</primary><secondary>is_union</secondary></indexterm><indexterm type="class_name"><primary>is_pod</primary><secondary>User Defined Specializations</secondary></indexterm><indexterm><primary>User Defined Specializations</primary><secondary>is_pod</secondary></indexterm><indexterm type="class_name"><primary>is_class</primary><secondary>User Defined Specializations</secondary></indexterm><indexterm><primary>User Defined Specializations</primary><secondary>is_class</secondary></indexterm> + <title><link linkend="boost_typetraits.user_defined"> User Defined Specializations</link></title> + <para> + Occationally the end user may need to provide their own specialization for + one of the type traits - typically where intrinsic compiler support is required + to implement a specific trait fully. These specializations should derive from + boost::<link linkend="boost_typetraits.reference.integral_constant">true_type</link> + or boost::<link linkend="boost_typetraits.reference.integral_constant">false_type</link> + as appropriate: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> + +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_pod</phrase><phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_union</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">char</phrase> <phrase role="identifier">c</phrase><phrase role="special">;</phrase> + <phrase role="keyword">int</phrase> <phrase role="identifier">i</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">namespace</phrase> <phrase role="identifier">boost</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_pod</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.intrinsics"><indexterm type="macro_name"><primary>BOOST_IS_UNION</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_UNION</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_POLYMORPHIC</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_POLYMORPHIC</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_POD</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_POD</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_ENUM</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_ENUM</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_EMPTY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_EMPTY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_CONVERTIBLE</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_CONVERTIBLE</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_CLASS</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_CLASS</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_BASE_OF</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_BASE_OF</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_ABSTRACT</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_ABSTRACT</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_VIRTUAL_DESTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_VIRTUAL_DESTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_DESTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_DESTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_COPY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_COPY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_CONSTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_CONSTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_ASSIGN</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_ASSIGN</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_COPY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_COPY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_CONSTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_CONSTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_ASSIGN</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_ASSIGN</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_ALIGNMENT_OF</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_ALIGNMENT_OF</secondary></indexterm> + <title><link linkend="boost_typetraits.intrinsics"> Support for Compiler Intrinsics</link></title> + <para> + There are some traits that can not be implemented within the current C++ language: + to make these traits "just work" with user defined types, some kind + of additional help from the compiler is required. Currently (April 2008) Visual + C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other + compilers will no doubt follow in due course. + </para> + <para> + The Following traits classes always need compiler support to do the right thing + for all types (but all have safe fallback positions if this support is unavailable): + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_union">is_union</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_pod">is_pod</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link> + </listitem> + </itemizedlist> + <para> + The following traits classes can't be portably implemented in the C++ language, + although in practice, the implementations do in fact do the right thing on + all the compilers we know about: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_empty">is_empty</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link> + </listitem> + </itemizedlist> + <para> + The following traits classes are dependent on one or more of the above: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_class">is_class</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link> + </listitem> + </itemizedlist> + <para> + The hooks for compiler-intrinsic support are defined in <ulink url="../../../../boost/type_traits/intrinsics.hpp">boost/type_traits/intrinsics.hpp</ulink>, + adding support for new compilers is simply a matter of defining one of more + of the following macros: + </para> + <table frame="all"> <title>Macros for Compiler Intrinsics</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + BOOST_IS_UNION(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a union type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + BOOST_IS_POD(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a POD type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_EMPTY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an empty struct or union + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if the default constructor for T is trivial (i.e. + has no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial copy constructor (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial assignment operator (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial destructor (i.e. ~T() has + no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">x</phrase><phrase role="special">;</phrase></computeroutput> + can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">(</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">t</phrase><phrase role="special">,</phrase> + <phrase role="identifier">u</phrase><phrase role="special">;</phrase> + <phrase role="identifier">t</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">u</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_VIRTUAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true T has a virtual destructor + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ABSTRACT(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an abstract type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_BASE_OF(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a base class of U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CLASS(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a class type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CONVERTIBLE(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is convertible to U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ENUM(T) + </para> + </entry><entry> + <para> + Should evaluate to true is T is an enum + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_POLYMORPHIC(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a polymorphic type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_ALIGNMENT_OF(T) + </para> + </entry><entry> + <para> + Should evaluate to the alignment requirements of type T. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.mpl"> + <title><link linkend="boost_typetraits.mpl"> MPL Interoperability</link></title> + <para> + All the value based traits in this library conform to MPL's requirements for + an <ulink url="../../../../libs/mpl/doc/refmanual/integral-constant.html">Integral + Constant type</ulink>: that includes a number of rather intrusive workarounds + for broken compilers. + </para> + <para> + Purely as an implementation detail, this means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">true_</phrase></computeroutput></ulink>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">false_</phrase></computeroutput></ulink>, + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> + <phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/integral-c.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">integral_c</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput></ulink> + (provided <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>) + </para> + </section> + <section id="boost_typetraits.examples"> + <title><link linkend="boost_typetraits.examples"> Examples</link></title> + <section id="boost_typetraits.examples.copy"> + <title><link linkend="boost_typetraits.examples.copy"> An Optimized Version + of std::copy</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">copy</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + to optimise the copy operation (see <ulink url="../../examples/copy_example.cpp">copy_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// opt::copy +</phrase><phrase role="comment">// same semantics as std::copy +</phrase><phrase role="comment">// calls memcpy where appropriate. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="identifier">I2</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">out</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">out</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">memcpy</phrase><phrase role="special">(</phrase><phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="special">(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">)*</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">));</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">+(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can copy with memcpy if T has a trivial assignment operator, +</phrase> <phrase role="comment">// and if the iterator arguments are actually pointers (this last +</phrase> <phrase role="comment">// requirement we detect with overload resolution): +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">value_type</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.fill"> + <title><link linkend="boost_typetraits.examples.fill"> An Optimised Version + of std::fill</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">fill</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memset</phrase></computeroutput> + to optimise the fill operation (see <ulink url="../../examples/fill_example.cpp">fill_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// fill +</phrase><phrase role="comment">// same as std::fill, but uses memset where appropriate +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">first</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">memset</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can do an optimised fill if T has a trivial assignment +</phrase> <phrase role="comment">// operator and if it's size is one: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> <phrase role="special">&&</phrase> <phrase role="special">(</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase> <phrase role="special">==</phrase> <phrase role="number">1</phrase><phrase role="special">)></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.destruct"> + <title><link linkend="boost_typetraits.examples.destruct"> An Example that + Omits Destructor Calls For Types with Trivial Destructors</link></title> + <para> + Demonstrates a simple algorithm that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">__has_trivial_destruct</phrase></computeroutput> + to determine whether to destructors need to be called (see <ulink url="../../examples/trivial_destructor_example.cpp">trivial_destructor_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// algorithm destroy_array: +</phrase><phrase role="comment">// The reverse of std::unitialized_copy, takes a block of +</phrase><phrase role="comment">// initialized memory and calls destructors on all objects therein. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="identifier">first</phrase><phrase role="special">->~</phrase><phrase role="identifier">T</phrase><phrase role="special">();</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> <phrase role="comment">// namespace detail +</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p2</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">p2</phrase><phrase role="special">,</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.iter"> + <title><link linkend="boost_typetraits.examples.iter"> An improved Version + of std::iter_swap</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + that use type traits to determine whether an it's arguments are proxying + iterators or not, if they're not then it just does a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase></computeroutput> + of it's dereferenced arguments (the same as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + does), however if they are proxying iterators then takes special care over + the swap to ensure that the algorithm works correctly for both proxying iterators, + and even iterators of different types (see <ulink url="../../examples/iter_swap_example.cpp">iter_swap_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// iter_swap: +</phrase><phrase role="comment">// tests whether iterator is a proxying iterator or not, and +</phrase><phrase role="comment">// uses optimal form accordingly: +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">v_t</phrase><phrase role="special">;</phrase> + <phrase role="identifier">v_t</phrase> <phrase role="identifier">v</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">one</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">one</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">two</phrase> <phrase role="special">=</phrase> <phrase role="identifier">v</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">using</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase><phrase role="special">;</phrase> + <phrase role="identifier">swap</phrase><phrase role="special">(*</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">iter_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">two</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// See is both arguments are non-proxying iterators, +</phrase> <phrase role="comment">// and if both iterator the same type: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r1_t</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I2</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">;</phrase> + + <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.to_double"> + <title><link linkend="boost_typetraits.examples.to_double"> Convert Numeric + Types and Enums to double</link></title> + <para> + Demonstrates a conversion of <ulink url="../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric + Types</ulink> and enum types to double: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">double</phrase> <phrase role="identifier">to_double</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">value</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">promoted</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric</phrase><phrase role="special">::</phrase><phrase role="identifier">converter</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase><phrase role="identifier">promoted</phrase><phrase role="special">>::</phrase><phrase role="identifier">convert</phrase><phrase role="special">(</phrase><phrase role="identifier">value</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.reference"> + <title><link linkend="boost_typetraits.reference"> Alphabetical Reference</link></title> + <section id="boost_typetraits.reference.add_const"><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>add_const</primary><secondary>add_const</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.add_const"> add_const</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_cv"><indexterm type="class_name"><primary>add_cv</primary><secondary>add_cv</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.add_cv"> add_cv</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + <tertiary>three</tertiary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_pointer"><indexterm type="class_name"><primary>add_pointer</primary><secondary>add_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.add_pointer"> add_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + <para> + The rationale for this template is that it produces the same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">TYPEOF</phrase><phrase role="special">(&</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput>, where + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">t</phrase></computeroutput> is an object of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_reference"><indexterm type="class_name"><primary>add_reference</primary><secondary>add_reference</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.add_reference"> add_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is not a reference type then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">&</phrase></computeroutput>, otherwise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_volatile"><indexterm type="class_name"><primary>add_volatile</primary><secondary>add_volatile</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.add_volatile"> add_volatile</link></title> + <indexterm type="class_name"> + <primary>one</primary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.aligned_storage"><indexterm type="class_name"><primary>aligned_storage</primary><secondary>aligned_storage</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.aligned_storage"> aligned_storage</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">aligned_storage</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with size + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Size</phrase></computeroutput> and an alignment that + is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">aligned_storage</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.alignment_of"><indexterm type="class_name"><primary>integral_constant</primary><secondary>alignment_of</secondary></indexterm><indexterm><primary>alignment_of</primary><secondary>integral_constant</secondary></indexterm><indexterm type="class_name"><primary>alignment_of</primary><secondary>alignment_of</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.alignment_of"> alignment_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">alignment_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template alignment<emphasis role="underline">of inherits from `</emphasis>_integral_constant<std::size_t, + ALIGNOF(T)><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">,</phrase> <phrase role="identifier">where</phrase> + </computeroutput>ALIGNOF(T)` is the alignment of type T. + </para> + <para> + <emphasis>Note: strictly speaking you should only rely on the value of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> being + a multiple of the true alignment of T, although in practice it does compute + the correct value in all the cases we know about.</emphasis> + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">alignment_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">char</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + with value <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.decay"><indexterm type="class_name"><primary>decay</primary><secondary>decay</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.decay"> decay</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">decay</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> Let <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + be the result of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput>, then if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + is an array type, the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>*</phrase></computeroutput>, + otherwise if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> is a function + type then the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase><phrase role="special">*</phrase></computeroutput>, otherwise the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">decay</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.extent"><indexterm type="class_name"><primary>integral_constant</primary><secondary>extent</secondary></indexterm><indexterm><primary>extent</primary><secondary>integral_constant</secondary></indexterm><indexterm type="class_name"><primary>extent</primary><secondary>extent</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.extent"> extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">extent</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template extent inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is the number of elements in the N'th array + dimention of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">N</phrase> <phrase role="special">></phrase> + <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput>, or if the N'th array bound is incomplete, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">],</phrase> + <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>4</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">],</phrase> <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.floating_point_promotion"><indexterm type="class_name"><primary>floating_point_promotion</primary><secondary>floating_point_promotion</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.floating_point_promotion"> + floating_point_promotion</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">floating_point_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If floating point promotion can be + applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies floating point promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">float</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.function_traits"><indexterm type="typedef_name"><primary>result_type</primary><secondary>function_traits</secondary></indexterm><indexterm><primary>function_traits</primary><secondary>result_type</secondary></indexterm><indexterm type="class_name"><primary>function_traits</primary><secondary>function_traits</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.function_traits"> function_traits</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">F</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">function_traits</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">arity</phrase> <phrase role="special">=</phrase> <replaceable>see-below</replaceable><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">result_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> arg<replaceable>N</replaceable>_type<phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + The class template function_traits will only compile if: + </para> + <itemizedlist> + <listitem> + The compiler supports partial specialization of class templates. + </listitem> + <listitem> + The template argument <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput> + is a <emphasis>function type</emphasis>, note that this <emphasis><emphasis role="bold">is not</emphasis></emphasis> the same thing as a <emphasis>pointer + to a function</emphasis>. + </listitem> + </itemizedlist> + <tip> + <para> + function_traits is intended to introspect only C++ functions of the form + R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member + functions. To convert a function pointer type to a suitable type use <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link>. + </para> + </tip> + <table frame="all"> <title>Function Traits Members</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Member + </para> + </entry><entry> + <para> + Description + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that gives the number of arguments + accepted by the function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type returned by function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase>arg<replaceable>N</replaceable>_type</computeroutput> + </para> + </entry><entry> + <para> + The <replaceable>N</replaceable>th argument type of function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="number">1</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">N</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">arity</phrase></computeroutput> of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 0. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 1. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 4. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">long</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arg1_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg4_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg5_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: there is no <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">arg5_type</phrase></computeroutput> + since there are only four arguments. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: argument type is a <emphasis>function pointer</emphasis>, + and not a <emphasis>function type</emphasis>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.has_nothrow_assign"><indexterm type="class_name"><primary>has_nothrow_assign</primary><secondary>has_nothrow_assign</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_nothrow_assign"> has_nothrow_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_assign</phrase></computeroutput> + will never report that a class or struct has a non-throwing assignment-operator; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler support to ensure that this trait "just + works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_constructor"><indexterm type="class_name"><primary>has_nothrow_default_constructor</primary><secondary>has_nothrow_constructor</secondary></indexterm><indexterm><primary>has_nothrow_constructor</primary><secondary>has_nothrow_default_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_nothrow_constructor</primary><secondary>has_nothrow_constructor</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_nothrow_constructor"> + has_nothrow_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_constructor</phrase></computeroutput> + will never report that a class or struct has a non-throwing default-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_copy"><indexterm type="class_name"><primary>has_nothrow_copy_constructor</primary><secondary>has_nothrow_copy</secondary></indexterm><indexterm><primary>has_nothrow_copy</primary><secondary>has_nothrow_copy_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_nothrow_copy</primary><secondary>has_nothrow_copy</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_nothrow_copy"> has_nothrow_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_copy</phrase></computeroutput> + will never report that a class or struct has a non-throwing copy-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_nothrow_cp_cons"> has_nothrow_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_no_throw_def_cons"> + <title><link linkend="boost_typetraits.reference.has_no_throw_def_cons"> has_nothrow_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_assign"><indexterm type="class_name"><primary>has_trivial_assign</primary><secondary>has_trivial_assign</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_trivial_assign"> has_trivial_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial assignment-operator then the operator has the same + effect as copying the bits of one object to the other: calls to the operator + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_assign + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p11. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_constructor"><indexterm type="class_name"><primary>has_trivial_default_constructor</primary><secondary>has_trivial_constructor</secondary></indexterm><indexterm><primary>has_trivial_constructor</primary><secondary>has_trivial_default_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_trivial_constructor</primary><secondary>has_trivial_constructor</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_trivial_constructor"> + has_trivial_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial default-constructor then the constructor have no + effect: calls to the constructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_constructor + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.1p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_copy"><indexterm type="class_name"><primary>has_trivial_copy_constructor</primary><secondary>has_trivial_copy</secondary></indexterm><indexterm><primary>has_trivial_copy</primary><secondary>has_trivial_copy_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_trivial_copy</primary><secondary>has_trivial_copy</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_trivial_copy"> has_trivial_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial copy-constructor then the constructor has the same + effect as copying the bits of one object to the other: calls to the constructor + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_copy + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_cp_cons"> has_trivial_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_def_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_def_cons"> has_trivial_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_destructor"><indexterm type="class_name"><primary>has_trivial_destructor</primary><secondary>has_trivial_destructor</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_trivial_destructor"> has_trivial_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial destructor then the destructor has no effect: calls + to the destructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_destructor + will never report that a user-defined class or struct has a trivial destructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4p3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_virtual_destructor"><indexterm type="class_name"><primary>has_virtual_destructor</primary><secondary>has_virtual_destructor</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.has_virtual_destructor"> has_virtual_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_virtual_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a virtual destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This trait is provided + for completeness, since it's part of the Technical Report on C++ Library + Extensions. However, there is currently no way to portably implement this + trait. The default version provided always inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + and has to be explicitly specialized for types with virtual destructors unless + the compiler used has compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + that enable the trait to do the right thing: currently (May 2005) only Visual + C++ 8 and GCC-4.3 have the necessary <link linkend="boost_typetraits.intrinsics">intrinsics</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_virtual_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.integral_constant"><indexterm type="typedef_name"><primary>true_type</primary><secondary>integral_constant</secondary></indexterm><indexterm><primary>integral_constant</primary><secondary>true_type</secondary></indexterm><indexterm type="class_name"><primary>integral_constant</primary><secondary>integral_constant</secondary></indexterm><indexterm type="typedef_name"><primary>false_type</primary><secondary>integral_constant</secondary></indexterm><indexterm><primary>integral_constant</primary><secondary>false_type</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.integral_constant"> integral_constant</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_constant</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">true</phrase><phrase role="special">></phrase> <phrase role="identifier">true_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">false</phrase><phrase role="special">></phrase> <phrase role="identifier">false_type</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + Class template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_constant</phrase></computeroutput> + is the common base class for all the value-based type traits. The two typedef's + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">true_type</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">false_type</phrase></computeroutput> are provided for convenience: + most of the value traits are Boolean properties and so will inherit from + one of these. + </para> + </section> + <section id="boost_typetraits.reference.integral_promotion"><indexterm type="class_name"><primary>integral_promotion</primary><secondary>integral_promotion</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.integral_promotion"> integral_promotion</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral promotion can be applied + to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, then + applies integral promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field). + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">integral_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">enum</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">float_round_style</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.is_abstract"><indexterm type="class_name"><primary>is_abstract</primary><secondary>is_abstract</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_abstract"> is_abstract</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_abstract</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + abstract type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_abstract</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The compiler must + support DR337 (as of April 2005: GCC 3.4, VC++ 7.1 (and later), Intel C++ + 7 (and later), and Comeau 4.3.2). Otherwise behaves the same as <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>; + this is the "safe fallback position" for which polymorphic types + are always regarded as potentially abstract. The macro BOOST_NO_IS_ABSTRACT + is used to signify that the implementation is buggy, users should check for + this in their own code if the "safe fallback" is not suitable for + their particular use-case. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">abc</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">abc</phrase><phrase role="special">()</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_arithmetic"><indexterm type="class_name"><primary>is_arithmetic</primary><secondary>is_arithmetic</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_arithmetic"> is_arithmetic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_arithmetic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + arithmetic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Arithmetic types include integral and floating point types (see also <link linkend="boost_typetraits.reference.is_integral">is_integral</link> and + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_arithmetic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_array"><indexterm type="class_name"><primary>is_array</primary><secondary>is_array</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_array"> is_array</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_array</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + array type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_array</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can give the wrong result with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_base_of"><indexterm type="class_name"><primary>is_base_of</primary><secondary>is_base_of</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_base_of"> is_base_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_base_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If Base is base class of type + Derived or if both types are the same then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + This template will detect non-public base classes, and ambiguous base classes. + </para> + <para> + Note that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">X</phrase><phrase role="special">,</phrase><phrase role="identifier">X</phrase><phrase role="special">></phrase></computeroutput> will always inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>. + <emphasis role="bold">This is the case even if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">X</phrase></computeroutput> + is not a class type</emphasis>. This is a change in behaviour from Boost-1.33 + in order to track the Technical Report on C++ Library Extensions. + </para> + <para> + Types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput> must not be incomplete types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_base_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. There are some older compilers which + will produce compiler errors if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> + is a private base class of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> is an ambiguous + base of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>. These compilers + include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and + older versions of EDG based compilers. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase> <phrase role="special">:</phrase> + <phrase role="keyword">public</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Base</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>: a class is regarded as it's + own base. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_class"><indexterm type="class_name"><primary>is_class</primary><secondary>is_class</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_class"> is_class</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_class</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + class type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types, as a result this type will erroneously inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> for + union types. See also <link linkend="boost_typetraits.reference.is_union">is_union</link>. + Currently (May 2005) only Visual C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to correctly identify union types, and therefore make is_class function correctly. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">MyClass</phrase><phrase role="special">;</phrase></computeroutput> then: + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_complex"><indexterm type="class_name"><primary>is_complex</primary><secondary>is_complex</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_complex"> is_complex</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_complex</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is a complex number type then true (of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">complex</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">></phrase></computeroutput> + for some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>), otherwise + false. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 26.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_complex</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.is_compound"><indexterm type="class_name"><primary>is_compound</primary><secondary>is_compound</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_compound"> is_compound</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_compound</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + compound type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Any type that is not a fundamental type is a compound type (see also <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_compound</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyEnum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_const"><indexterm type="class_name"><primary>is_const</primary><secondary>is_const</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_const"> is_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_const</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) const-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_convertible"><indexterm type="class_name"><primary>is_convertible</primary><secondary>is_convertible</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_convertible"> is_convertible</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_convertible</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If an imaginary lvalue of type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> is convertible to type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type From must not be an incomplete type. + </para> + <para> + Type To must not be an incomplete, or function type. + </para> + <para> + No types are considered to be convertible to array types or abstract-class + types. + </para> + <para> + This template can not detect whether a converting-constructor is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> or not: if type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">private</phrase></computeroutput> converting constructor + from type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> then instantiating + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase></computeroutput> + will produce a compiler error. For this reason <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase></computeroutput> + can not be used to determine whether a type has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> + copy-constructor or not. + </para> + <para> + This template will also produce compiler errors if the conversion is ambiguous, + for example: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">B</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">C</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">D</phrase> <phrase role="special">:</phrase> <phrase role="identifier">B</phrase><phrase role="special">,</phrase> <phrase role="identifier">C</phrase> <phrase role="special">{};</phrase> +<phrase role="comment">// This produces a compiler error, the conversion is ambiguous: +</phrase><phrase role="keyword">bool</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">D</phrase><phrase role="special">*,</phrase><phrase role="identifier">A</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4 and 8.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This template is + currently broken with Borland C++ Builder 5 (and earlier), for constructor-based + conversions, and for the Metrowerks 7 (and earlier) compiler in all cases. + If the compiler does not support <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_abstract">is_abstract</link></computeroutput>, + then the template parameter <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + must not be an abstract type. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the conversion would require a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const_cast</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&,</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_empty"><indexterm type="class_name"><primary>is_empty</primary><secondary>is_empty</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_empty"> is_empty</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_empty</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an empty class type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10p5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> In order to correctly + detect empty classes this trait relies on either: + </para> + <itemizedlist> + <listitem> + the compiler implementing zero sized empty base classes, or + </listitem> + <listitem> + the compiler providing <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect empty classes. + </listitem> + </itemizedlist> + <para> + Can not be used with incomplete types. + </para> + <para> + Can not be used with union types, until is_union can be made to work. + </para> + <para> + If the compiler does not support partial-specialization of class templates, + then this template can not be used with abstract types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">empty_class</phrase> + <phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_enum"><indexterm type="class_name"><primary>is_enum</primary><secondary>is_enum</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_enum"> is_enum</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_enum</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + enum type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_enum</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Requires a correctly + functioning <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template; this means that is_enum is currently broken under Borland C++ Builder + 5, and for the Metrowerks compiler prior to version 8, other compilers should + handle this template just fine. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">enum</phrase> <phrase role="identifier">my_enum</phrase> + <phrase role="special">{</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_floating_point"><indexterm type="class_name"><primary>is_floating_point</primary><secondary>is_floating_point</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_floating_point"> is_floating_point</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_floating_point</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + floating point type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_floating_point</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_function"><indexterm type="function_name"><primary>int</primary><secondary>is_function</secondary></indexterm><indexterm><primary>is_function</primary><secondary>int</secondary></indexterm><indexterm type="class_name"><primary>is_function</primary><secondary>is_function</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_function"> is_function</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_function</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + function type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Note that this template does not detect <emphasis>pointers to functions</emphasis>, + or <emphasis>references to functions</emphasis>, these are detected by <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> and <link linkend="boost_typetraits.reference.is_reference">is_reference</link> respectively: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="identifier">f1</phrase><phrase role="special">();</phrase> <phrase role="comment">// f1 is of function type. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f2</phrase><phrase role="special">*)();</phrase> <phrase role="comment">// f2 is a pointer to a function. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f3</phrase><phrase role="special">&)();</phrase> <phrase role="comment">// f3 is a reference to a function. +</phrase></programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p1 and 8.3.5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_function</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer type, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a reference to a function, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer to a member function. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <tip> + <para> + Don't confuse function-types with pointers to functions: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> + <phrase role="identifier">f</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">);</phrase></computeroutput> + </para> + <para> + defines a function type, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase> <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a prototype for a function of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase></computeroutput>, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">*</phrase> + <phrase role="identifier">pf</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">&</phrase> + <phrase role="identifier">fr</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a pointer and a reference to the function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">foo</phrase></computeroutput>. + </para> + <para> + If you want to detect whether some type is a pointer-to-function then use: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special"><</phrase><link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + </para> + <para> + or for pointers to member functions you can just use <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + directly. + </para> + </tip> + </section> + <section id="boost_typetraits.reference.is_fundamental"><indexterm type="class_name"><primary>is_fundamental</primary><secondary>is_fundamental</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_fundamental"> is_fundamental</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_fundamental</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + fundamental type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Fundamental types include integral, floating point and void types (see also + <link linkend="boost_typetraits.reference.is_integral">is_integral</link>, + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link> + and <link linkend="boost_typetraits.reference.is_void">is_void</link>) + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_fundamental</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_integral"><indexterm type="class_name"><primary>is_integral</primary><secondary>is_integral</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_integral"> is_integral</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_integral</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + integral type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p7. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_integral</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_function_pointer"><indexterm type="class_name"><primary>is_member_function_pointer</primary><secondary>is_member_function_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_member_function_pointer"> + is_member_function_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_function_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member function then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a data member and not a member + function, see <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_object_pointer"><indexterm type="class_name"><primary>is_member_object_pointer</primary><secondary>is_member_object_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_member_object_pointer"> + is_member_object_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_object_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member object (a data member) then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a member function and not a + member object, see <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_pointer"><indexterm type="class_name"><primary>is_member_pointer</primary><secondary>is_member_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_member_pointer"> is_member_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member (either a function or a data member) then inherits from + <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_object"><indexterm type="class_name"><primary>is_object</primary><secondary>is_object</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_object"> is_object</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_object</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + object type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + All types are object types except references, void, and function types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_object</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: reference types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: function types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + void is not an object type + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pod"><indexterm type="class_name"><primary>is_pod</primary><secondary>is_pod</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_pod"> is_pod</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pod</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + POD type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + POD stands for "Plain old data". Arithmetic types, and enumeration + types, a pointers and pointer to members are all PODs. Classes and unions + can also be POD's if they have no non-static data members that are of reference + or non-POD type, no user defined constructors, no user defined assignment + operators, no private or protected non-static data members, no virtual functions + and no base classes. Finally, a cv-qualified POD is still a POD, as is an + array of PODs. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10 and 9p4 (Note + that POD's are also aggregates, see 8.5.1). + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is<emphasis role="underline">pod + will never report that a class or struct is a POD; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler-</emphasis>_intrinsics. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pointer"><indexterm type="class_name"><primary>is_pointer</primary><secondary>is_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_pointer"> is_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer type (includes function pointers, but excludes pointers to members) + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p2 and 8.3.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <important> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> detects "real" + pointer types only, and <emphasis>not</emphasis> smart pointers. Users + should not specialise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> + for smart pointer types, as doing so may cause Boost (and other third party) + code to fail to function correctly. Users wanting a trait to detect smart + pointers should create their own. However, note that there is no way in + general to auto-magically detect smart pointer types, so such a trait would + have to be partially specialised for each supported smart pointer type. + </para> + </important> + </section> + <section id="boost_typetraits.reference.is_polymorphic"><indexterm type="class_name"><primary>is_polymorphic</primary><secondary>is_polymorphic</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_polymorphic"> is_polymorphic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_polymorphic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + polymorphic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The implementation + requires some knowledge of the compilers ABI, it does actually seem to work + with the majority of compilers though. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_polymorphic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">poly</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">poly</phrase><phrase role="special">();</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_same"><indexterm type="class_name"><primary>is_same</primary><secondary>is_same</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_same"> is_same</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_same</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T and U are the same types + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_same</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with abstract, incomplete or function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_scalar"><indexterm type="class_name"><primary>is_scalar</primary><secondary>is_scalar</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_scalar"> is_scalar</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_scalar</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + scalar type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Scalar types include integral, floating point, enumeration, pointer, and + pointer-to-member types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_scalar</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_signed"><indexterm type="class_name"><primary>is_signed</primary><secondary>is_signed</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_signed"> is_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_signed</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an signed integer type + or an enumerated type with an underlying signed integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_stateless"><indexterm type="class_name"><primary>is_stateless</primary><secondary>is_stateless</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_stateless"> is_stateless</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_stateless</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Ff T is a stateless type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type T must be a complete type. + </para> + <para> + A stateless type is a type that has no storage and whose constructors and + destructors are trivial. That means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_stateless</phrase></computeroutput> + only inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the following expression is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">true</phrase></computeroutput>: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_stateless</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is_stateless will + never report that a class or struct is stateless; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this template work automatically. + </para> + </section> + <section id="boost_typetraits.reference.is_reference"><indexterm type="class_name"><primary>is_reference</primary><secondary>is_reference</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_reference"> is_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_reference</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a reference pointer type + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + may report the wrong result for function types, and for types that are both + const and volatile qualified. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis> (the argument in this case + is a reference to a function). + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_union"><indexterm type="class_name"><primary>is_union</primary><secondary>is_union</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_union"> is_union</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_union</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + union type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Currently requires some kind of compiler support, otherwise unions are identified + as classes. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types using only standard C++, as a result this type will never + inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + unless the user explicitly specializes the template for their user-defined + union types, or unless the compiler supplies some unspecified intrinsic that + implements this functionality. Currently (May 2005) only Visual C++ 8 has + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this trait "just work" without user intervention. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_unsigned"><indexterm type="class_name"><primary>is_unsigned</primary><secondary>is_unsigned</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_unsigned"> is_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_unsigned</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an unsigned integer type + or an enumerated type with an underlying unsigned integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_void"><indexterm type="class_name"><primary>is_void</primary><secondary>is_void</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_void"> is_void</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_void</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + void type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_void</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_volatile"><indexterm type="class_name"><primary>is_volatile</primary><secondary>is_volatile</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.is_volatile"> is_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_volatile</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) volatile-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">volatile</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase> + <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the volatile qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.make_signed"><indexterm type="class_name"><primary>make_signed</primary><secondary>make_signed</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.make_signed"> make_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_signed</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a signed integer type then + the same type as T, if T is an unsigned integer type then the corresponding + signed type. Otherwise if T is an enumerated or character type (char or wchar_t) + then a signed integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.make_unsigned"><indexterm type="class_name"><primary>make_unsigned</primary><secondary>make_unsigned</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.make_unsigned"> make_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_unsigned</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a unsigned integer type then + the same type as T, if T is an signed integer type then the corresponding + unsigned type. Otherwise if T is an enumerated or character type (char or + wchar_t) then an unsigned integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.promote"><indexterm type="class_name"><primary>promote</primary><secondary>promote</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.promote"> promote</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">promote</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral or floating point promotion + can be applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies integral and floating point promotions to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + See also <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link> + and <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field) and 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">promote</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.rank"><indexterm type="class_name"><primary>rank</primary><secondary>rank</secondary></indexterm><indexterm type="class_name"><primary>integral_constant</primary><secondary>rank</secondary></indexterm><indexterm><primary>rank</primary><secondary>integral_constant</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.rank"> rank</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">rank</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template rank inherits from + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is the + number of array dimensions in type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">rank</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[]></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>1</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.remove_all_extents"><indexterm type="class_name"><primary>remove_all_extents</primary><secondary>remove_all_extents</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_all_extents"> remove_all_extents</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_all_extents</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes all of the array bounds on <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_all_extents</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_const"><indexterm type="class_name"><primary>remove_const</primary><secondary>remove_const</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_const"> remove_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> const-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_cv"><indexterm type="class_name"><primary>remove_cv</primary><secondary>remove_cv</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_cv"> remove_cv</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> cv-qualifiers removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_extent"><indexterm type="class_name"><primary>remove_extent</primary><secondary>remove_extent</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_extent"> remove_extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_extent</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes the topmost array bound, otherwise leaves + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_pointer"><indexterm type="class_name"><primary>remove_pointer</primary><secondary>remove_pointer</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_pointer"> remove_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any pointer modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">**>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_reference"><indexterm type="class_name"><primary>remove_reference</primary><secondary>remove_reference</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_reference"> remove_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any reference modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_volatile"><indexterm type="class_name"><primary>remove_volatile</primary><secondary>remove_volatile</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.remove_volatile"> remove_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> volatile-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.type_with_alignment"><indexterm type="class_name"><primary>type_with_alignment</primary><secondary>type_with_alignment</secondary></indexterm> + <title><link linkend="boost_typetraits.reference.type_with_alignment"> type_with_alignment</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">type_with_alignment</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with an alignment + that is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">type_with_alignment</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + </section> + <section id="boost_typetraits.credits"> + <title><link linkend="boost_typetraits.credits"> Credits</link></title> + <para> + This documentation was pulled together by John Maddock, using <ulink url="../../../../doc/html/quickbook.html">Boost.Quickbook</ulink> + and <ulink url="../../../../doc/html/boostbook.html">Boost.DocBook</ulink>. + </para> + <para> + The original version of this library was created by Steve Cleary, Beman Dawes, + Howard Hinnant, and John Maddock. John Maddock is the current maintainer of + the library. + </para> + <para> + This version of type traits library is based on contributions by Adobe Systems + Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, + Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert + Ramey and Jeremy Siek. + </para> + <para> + Mat Marcus and Jesse Jones invented, and <ulink url="http://opensource.adobe.com/project4/project.shtml">published + a paper describing</ulink>, the partial specialization workarounds used in + this library. + </para> + <para> + Aleksey Gurtovoy added MPL integration to the library. + </para> + <para> + The <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template is based on code originally devised by Andrei Alexandrescu, see "<ulink url="http://www.cuj.com/experts/1810/alexandr.htm?topic=experts">Generic<Programming>: + Mappings between Types and Values</ulink>". + </para> + <para> + The latest version of this library and documentation can be found at <ulink url="http://www.boost.org">www.boost.org</ulink>. Bugs, suggestions and discussion + should be directed to boost@lists.boost.org (see <ulink url="http://www.boost.org/more/mailing_lists.htm#main">www.boost.org/more/mailing_lists.htm#main</ulink> + for subscription details). + </para> + </section> + + <section id="boost_typetraits.ignored_section"> + <title>This section must not be indexed.</title> + <?BoostAutoIndex IgnoreSection?> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + <section id="boost_typetraits.ignored_block"><indexterm type="class_name"><primary>add_volatile</primary><secondary>This section contains one block that must not be indexed and one that should be.</secondary></indexterm><indexterm><primary>This section contains one block that must not be indexed and one that should be.</primary><secondary>add_volatile</secondary></indexterm> + <title>This section contains one block that must not be indexed and one that should be.</title> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + <?BoostAutoIndex IgnoreBlock?> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + + <index type="class_name"> + <title>Class Index</title> + </index> + <index type="typedef_name"> + <title>Typedef Index</title> + </index> + <index type="macro_name"> + <title>Macro Index</title> + </index> + <index type="test_index_1"> + <title>Index Test 1</title> + </index> + <index type="test_index_2"> + <title>Index Test 2</title> + </index> + <index/> + +</chapter>
\ No newline at end of file diff --git a/tools/auto_index/test/test2.gold b/tools/auto_index/test/test2.gold new file mode 100644 index 0000000000..154af9abf4 --- /dev/null +++ b/tools/auto_index/test/test2.gold @@ -0,0 +1,6671 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> +<!-- + +This file is based upon the type traits docs, but has had additional XML elements added to it +to ensure complete testing. + +--> + +<chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="boost_typetraits" rev:last-revision="$Date: 2008-11-28 12:41:45 +0000 (Fri, 28 Nov 2008) $"> + <chapterinfo><author> + <firstname>various</firstname> <surname>authors</surname> + </author><copyright> + <year>2000</year> <year>2006</year> <holder>Adobe Systems Inc, David Abrahams, + Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat + Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert + Ramey and Jeremy Siek</holder> + </copyright><legalnotice> + <para> + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) + </para> + </legalnotice></chapterinfo> + <title>Boost.TypeTraits</title> + <para> + A printer-friendly <ulink url="http://svn.boost.org/svn/boost/sandbox/pdf/type_traits/release/type_traits.pdf">PDF + version of this manual is also available</ulink>. + </para> + <section id="boost_typetraits.intro"> + <title><link linkend="boost_typetraits.intro"> Introduction</link></title> + <para> + The Boost type-traits library contains a set of very specific traits classes, + each of which encapsulate a single trait from the C++ type system; for example, + is a type a pointer or a reference type? Or does a type have a trivial constructor, + or a const-qualifier? + </para> + <para> + The type-traits classes share a unified design: each class inherits from a + the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. + </para> + </section> + <section id="boost_typetraits.background"> + <title><link linkend="boost_typetraits.background"> Background and Tutorial</link></title> + <para> + The following is an updated version of the article "C++ Type traits" + by John Maddock and Steve Cleary that appeared in the October 2000 issue of + <ulink url="http://www.ddj.com">Dr Dobb's Journal</ulink>. + </para> + <para> + Generic programming (writing code which works with any data type meeting a + set of requirements) has become the method of choice for providing reusable + code. However, there are times in generic programming when "generic" + just isn't good enough - sometimes the differences between types are too large + for an efficient generic implementation. This is when the traits technique + becomes important - by encapsulating those properties that need to be considered + on a type by type basis inside a traits class, we can minimize the amount of + code that has to differ from one type to another, and maximize the amount of + generic code. + </para> + <?dbfo keep-together="auto" ?> + <para> + <indexterm> + <primary>Foo1</primary> + </indexterm> + Consider an example: when working with character strings, one common operation + is to determine the length of a null terminated string. Clearly it's possible + to write generic code that can do this, but it turns out that there are much + more efficient methods available: for example, the C library functions <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">strlen</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">wcslen</phrase></computeroutput> + are usually written in assembler, and with suitable hardware support can be + considerably faster than a generic version written in C++. The authors of the + C++ standard library realized this, and abstracted the properties of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">wchar_t</phrase></computeroutput> + into the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput>. + Generic code that works with character strings can simply use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase><phrase role="special"><>::</phrase><phrase role="identifier">length</phrase></computeroutput> to determine the length of a null + terminated string, safe in the knowledge that specializations of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> will use the most appropriate + method available to them. + </para> + <anchor id="boost_typetraits.background.type_traits"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.type_traits">Type Traits</link> + </bridgehead> + <para> + Class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> is a classic + example of a collection of type specific properties wrapped up in a single + class - what Nathan Myers termed a <emphasis>baggage class</emphasis><link linkend="background.references">[1]</link>. In the Boost type-traits library, + we<link linkend="background.references">[2]</link> have written a set of very + specific traits classes, each of which encapsulate a single trait from the + C++ type system; for example, is a type a pointer or a reference type? Or does + a type have a trivial constructor, or a const-qualifier? The type-traits classes + share a unified design: each class inherits from a the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. As we will show, these classes can be used in generic programming + to determine the properties of a given type and introduce optimizations that + are appropriate for that case. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. All of the type-traits classes are + defined inside namespace <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase></computeroutput>; + for brevity, namespace-qualification is omitted in most of the code samples + given. + </para> + <anchor id="boost_typetraits.background.implementation"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.implementation">Implementation</link> + </bridgehead> + <para> + There are far too many separate classes contained in the type-traits library + to give a full implementation here - see the source code in the Boost library + for the full details - however, most of the implementation is fairly repetitive + anyway, so here we will just give you a flavor for how some of the classes + are implemented. Beginning with possibly the simplest class in the library, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput> inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + only if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + Here we define a primary version of the template class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_void">is_void</link></computeroutput>, + and provide a full-specialization when <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. While full specialization + of a template class is an important technique, sometimes we need a solution + that is halfway between a fully generic solution, and a full specialization. + This is exactly the situation for which the standards committee defined partial + template-class specialization. As an example, consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>: + here we needed a primary version that handles all the cases where T is not + a pointer, and a partial specialization to handle all the cases where T is + a pointer: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">*></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + The syntax for partial specialization is somewhat arcane and could easily occupy + an article in its own right; like full specialization, in order to write a + partial specialization for a class, you must first declare the primary template. + The partial specialization contains an extra <...> after the class name + that contains the partial specialization parameters; these define the types + that will bind to that partial specialization rather than the default template. + The rules for what can appear in a partial specialization are somewhat convoluted, + but as a rule of thumb if you can legally write two function overloads of the + form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">);</phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">U</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Then you can also write a partial specialization of the form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + This rule is by no means foolproof, but it is reasonably simple to remember + and close enough to the actual rule to be useful for everyday use. + </para> + <para> + As a more complex example of partial specialization consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>. This + class defines a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the same type as T but with any top-level array bounds removed; this + is an example of a traits class that performs a transformation on a type: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">[</phrase><phrase role="identifier">N</phrase><phrase role="special">]></phrase> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + The aim of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + is this: imagine a generic algorithm that is passed an array type as a template + parameter, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + provides a means of determining the underlying type of the array. For example + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">][</phrase><phrase role="number">5</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> would evaluate to the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">5</phrase><phrase role="special">]</phrase></computeroutput>. This example also shows that the number of + template parameters in a partial specialization does not have to match the + number in the default template. However, the number of parameters that appear + after the class name do have to match the number and type of the parameters + in the default template. + </para> + <anchor id="boost_typetraits.background.optimized_copy"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.optimized_copy">Optimized copy</link> + </bridgehead> + <para> + As an example of how the type traits classes can be used, consider the standard + library algorithm copy: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">Iter1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Iter2</phrase><phrase role="special">></phrase> +<phrase role="identifier">Iter2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">Iter1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter2</phrase> <phrase role="identifier">out</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Obviously, there's no problem writing a generic version of copy that works + for all iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput>; however, there are + some circumstances when the copy operation can best be performed by a call + to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. In order to implement + copy in terms of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> all + of the following conditions need to be met: + </para> + <itemizedlist> + <listitem> + Both of the iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must be pointers. + </listitem> + <listitem> + Both <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must point to the same type - excluding + const and volatile-qualifiers. + </listitem> + <listitem> + The type pointed to by <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + must have a trivial assignment operator. + </listitem> + </itemizedlist> + <para> + By trivial assignment operator we mean that the type is either a scalar type<link linkend="background.references">[3]</link> or: + </para> + <itemizedlist> + <listitem> + The type has no user defined assignment operator. + </listitem> + <listitem> + The type does not have any data members that are references. + </listitem> + <listitem> + All base classes, and all data member objects must have trivial assignment + operators. + </listitem> + </itemizedlist> + <para> + If all these conditions are met then a type can be copied using <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> rather than using a compiler generated + assignment operator. The type-traits library provides a class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>, + such that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is true only if T has a trivial assignment + operator. This class "just works" for scalar types, but has to be + explicitly specialised for class/struct types that also happen to have a trivial + assignment operator. In other words if <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + gives the wrong answer, it will give the "safe" wrong answer - that + trivial assignment is not allowable. + </para> + <para> + The code for an optimized version of copy that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + where appropriate is given in <link linkend="boost_typetraits.examples.copy">the + examples</link>. The code begins by defining a template function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">do_copy</phrase></computeroutput> that performs a "slow but safe" + copy. The last parameter passed to this function may be either a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + or a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>. + Following that there is an overload of do<emphasis role="underline">copy that + uses `memcpy`: this time the iterators are required to actually be pointers + to the same type, and the final parameter must be a `</emphasis>_true_type<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">.</phrase> <phrase role="identifier">Finally</phrase><phrase role="special">,</phrase> <phrase role="identifier">the</phrase> <phrase role="identifier">version</phrase> + <phrase role="identifier">of</phrase> </computeroutput>copy<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="identifier">calls</phrase> + </computeroutput>do<emphasis role="underline">copy`, passing `</emphasis>_has_trivial_assign<value_type>()` + as the final parameter: this will dispatch to the optimized version where appropriate, + otherwise it will call the "slow but safe version". + </para> + <anchor id="boost_typetraits.background.was_it_worth_it_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.was_it_worth_it_">Was it worth it?</link> + </bridgehead> + <para> + It has often been repeated in these columns that "premature optimization + is the root of all evil" <link linkend="background.references">[4]</link>. + So the question must be asked: was our optimization premature? To put this + in perspective the timings for our version of copy compared a conventional + generic copy<link linkend="background.references">[5]</link> are shown in table + 1. + </para> + <para> + Clearly the optimization makes a difference in this case; but, to be fair, + the timings are loaded to exclude cache miss effects - without this accurate + comparison between algorithms becomes difficult. However, perhaps we can add + a couple of caveats to the premature optimization rule: + </para> + <itemizedlist> + <listitem> + If you use the right algorithm for the job in the first place then optimization + will not be required; in some cases, memcpy is the right algorithm. + </listitem> + <listitem> + If a component is going to be reused in many places by many people then optimizations + may well be worthwhile where they would not be so for a single case - in + other words, the likelihood that the optimization will be absolutely necessary + somewhere, sometime is that much higher. Just as importantly the perceived + value of the stock implementation will be higher: there is no point standardizing + an algorithm if users reject it on the grounds that there are better, more + heavily optimized versions available. + </listitem> + </itemizedlist> + <table frame="all"> <title>Time taken to copy 1000 elements using `copy<const + T*, T*>` (times in micro-seconds)</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Version + </para> + </entry><entry> + <para> + T + </para> + </entry><entry> + <para> + Time + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 0.99 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 8.07 + </para> + </entry> + </row> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 2.52 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 8.02 + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <anchor id="boost_typetraits.background.pair_of_references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.pair_of_references">Pair of References</link> + </bridgehead> + <para> + The optimized copy example shows how type traits may be used to perform optimization + decisions at compile-time. Another important usage of type traits is to allow + code to compile that otherwise would not do so unless excessive partial specialization + is used. This is possible by delegating partial specialization to the type + traits classes. Our example for this form of usage is a pair that can hold + references <link linkend="background.references">[6]</link>. + </para> + <para> + First, let us examine the definition of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput>, omitting + the comparison operators, default constructor, and template copy constructor + for simplicity: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Now, this "pair" cannot hold references as it currently stands, because + the constructor would require taking a reference to a reference, which is currently + illegal <link linkend="background.references">[7]</link>. Let us consider what + the constructor's parameters would have to be in order to allow "pair" + to hold non-reference types, references, and constant references: + </para> + <table frame="all"> <title>Required Constructor Argument Types</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of parameter to initializing constructor + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + A little familiarity with the type traits classes allows us to construct a + single mapping that allows us to determine the type of parameter from the type + of the contained class. The type traits classes provide a transformation <link linkend="boost_typetraits.reference.add_reference">add_reference</link>, which + adds a reference to its type, unless it is already a reference. + </para> + <table frame="all"> <title>Using add_reference to synthesize the correct constructor + type</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & [8] + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + This allows us to build a primary template definition for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> + that can contain non-reference types, reference types, and constant reference + types: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> + <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Add back in the standard comparison operators, default constructor, and template + copy constructor (which are all the same), and you have a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput> that + can hold reference types! + </para> + <para> + This same extension could have been done using partial template specialization + of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>, but to specialize + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> in this way would require + three partial specializations, plus the primary template. Type traits allows + us to define a single primary template that adjusts itself auto-magically to + any of these partial specializations, instead of a brute-force partial specialization + approach. Using type traits in this fashion allows programmers to delegate + partial specialization to the type traits classes, resulting in code that is + easier to maintain and easier to understand. + </para> + <anchor id="boost_typetraits.background.conclusion"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.conclusion">Conclusion</link> + </bridgehead> + <para> + We hope that in this article we have been able to give you some idea of what + type-traits are all about. A more complete listing of the available classes + are in the boost documentation, along with further examples using type traits. + Templates have enabled C++ uses to take the advantage of the code reuse that + generic programming brings; hopefully this article has shown that generic programming + does not have to sink to the lowest common denominator, and that templates + can be optimal as well as generic. + </para> + <anchor id="boost_typetraits.background.acknowledgements"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.acknowledgements">Acknowledgements</link> + </bridgehead> + <para> + The authors would like to thank Beman Dawes and Howard Hinnant for their helpful + comments when preparing this article. + </para> + <anchor id="background.references"/> <anchor id="boost_typetraits.background.references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.references">References</link> + </bridgehead> + <orderedlist inheritnum="ignore" continuation="restarts"> + <listitem> + Nathan C. Myers, C++ Report, June 1995. + </listitem> + <listitem> + The type traits library is based upon contributions by Steve Cleary, Beman + Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org. + </listitem> + <listitem> + A scalar type is an arithmetic type (i.e. a built-in integer or floating + point type), an enumeration type, a pointer, a pointer to member, or a const- + or volatile-qualified version of one of these types. + </listitem> + <listitem> + This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg + 268. + </listitem> + <listitem> + The test code is available as part of the boost utility library (see algo_opt_examples.cpp), + the code was compiled with gcc 2.95 with all optimisations turned on, tests + were conducted on a 400MHz Pentium II machine running Microsoft Windows 98. + </listitem> + <listitem> + John Maddock and Howard Hinnant have submitted a "compressed_pair" + library to Boost, which uses a technique similar to the one described here + to hold references. Their pair also uses type traits to determine if any + of the types are empty, and will derive instead of contain to conserve space + -- hence the name "compressed". + </listitem> + <listitem> + This is actually an issue with the C++ Core Language Working Group (issue + #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow + a "reference to a reference to T" to mean the same thing as a "reference + to T", but only in template instantiation, in a method similar to multiple + cv-qualifiers. + </listitem> + <listitem> + For those of you who are wondering why this shouldn't be const-qualified, + remember that references are always implicitly constant (for example, you + can't re-assign a reference). Remember also that "const T &" + is something completely different. For this reason, cv-qualifiers on template + type arguments that are references are ignored. + </listitem> + </orderedlist> + </section> + <section id="boost_typetraits.category"> + <title><link linkend="boost_typetraits.category"> Type Traits by Category</link></title> + <section id="boost_typetraits.category.value_traits"> + <title><link linkend="boost_typetraits.category.value_traits"> Type Traits + that Describe the Properties of a Type</link></title> + <para> + <indexterm> + <primary>Foo2</primary> + <secondary>Bar2</secondary> + </indexterm> + These traits are all <emphasis>value traits</emphasis>, which is to say the + traits classes all inherit from <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link>, + and are used to access some numerical property of a type. Often this is a + simple true or false Boolean value, but in a few cases may be some other + integer value (for example when dealing with type alignments, or array bounds: + see <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.alignment_of">alignment_of</link></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.rank">rank</link></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.extent">extent</link></computeroutput>). + </para> + <section id="boost_typetraits.category.value_traits.primary"> + <title><link linkend="boost_typetraits.category.value_traits.primary"> Categorizing + a Type</link></title> + <para> + These traits identify what "kind" of type some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is. These are split into two groups: + primary traits which are all mutually exclusive, and composite traits that + are compositions of one or more primary traits. + </para> + <para> + For any given type, exactly one primary type trait will inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + and all the others will inherit from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + in other words these traits are mutually exclusive. + </para> + <para> + This means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + will only ever be true for built-in types; if you want to check for a user-defined + class type that behaves "as if" it is an integral or floating + point type, then use the <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric_limits</phrase> + <phrase role="keyword">template</phrase></computeroutput> instead. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_array">is_array</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_complex">is_complex</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_enum">is_enum</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">;</phrase> +</programlisting> + <para> + The following traits are made up of the union of one or more type categorizations. + A type may belong to more than one of these categories, in addition to + one of the primary categories. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_arithmetic">is_arithmetic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_compound">is_compound</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_object">is_object</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_scalar">is_scalar</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.properties"> + <title><link linkend="boost_typetraits.category.value_traits.properties"> + General Type Properties</link></title> + <para> + The following templates describe the general properties of a type. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.alignment_of">alignment_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_abstract">is_abstract</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_const">is_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_empty">is_empty</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_signed">is_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_unsigned">is_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_volatile">is_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.extent">extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.relate"> + <title><link linkend="boost_typetraits.category.value_traits.relate"> Relationships + Between Two Types</link></title> + <para> + These templates determine the whether there is a relationship between two + types: + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_base_of">is_base_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.category.transform"> + <title><link linkend="boost_typetraits.category.transform"> Type Traits that + Transform One Type to Another</link></title> + <para> + The following templates transform one type to another, based upon some well-defined + rule. Each template has a single member called <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of applying the transformation to the template argument + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_const">add_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_cv">add_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_pointer">add_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_volatile">add_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.decay">decay</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_signed">make_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_unsigned">make_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.promote">promote</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_all_extents">remove_all_extents</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_const">remove_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_cv">remove_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_reference">remove_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_volatile">remove_volatile</link><phrase role="special">;</phrase> +</programlisting> + <anchor id="boost_typetraits.category.transform.broken_compiler_workarounds_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">Broken + Compiler Workarounds:</link> + </bridgehead> + <para> + For all of these templates support for partial specialization of class templates + is required to correctly implement the transformation. On the other hand, + practice shows that many of the templates from this category are very useful, + and often essential for implementing some generic libraries. Lack of these + templates is often one of the major limiting factors in porting those libraries + to compilers that do not yet support this language feature. As some of these + compilers are going to be around for a while, and at least one of them is + very wide-spread, it was decided that the library should provide workarounds + where possible. + </para> + <para> + The basic idea behind the workaround is to manually define full specializations + of all type transformation templates for all fundamental types, and all their + 1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide + a user-level macro that will define all the explicit specializations needed + for any user-defined type T. + </para> + <para> + The first part guarantees the successful compilation of something like this: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="special">...</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +</programlisting> + <para> + and the second part provides the library's users with a mechanism to make + the above code work not only for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> or other built-in type, + but for their own types as well: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">namespace</phrase> <phrase role="identifier">myspace</phrase><phrase role="special">{</phrase> + <phrase role="keyword">struct</phrase> <phrase role="identifier">MyClass</phrase> <phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +<phrase role="comment">// declare this at global scope: +</phrase><phrase role="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase><phrase role="special">(</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">)</phrase> +<phrase role="comment">// transformations on myspace::MyClass now work: +</phrase><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="comment">// etc. +</phrase></programlisting> + <para> + Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates + to nothing on those compilers that <emphasis role="bold">do</emphasis> support + partial specialization. + </para> + </section> + <section id="boost_typetraits.category.alignment"> + <title><link linkend="boost_typetraits.category.alignment"> Synthesizing Types + with Specific Alignments</link></title> + <para> + Some low level memory management routines need to synthesize a POD type with + specific alignment properties. The template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link></computeroutput> + finds the smallest type with a specified alignment, while template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link></computeroutput> + creates a type with a specific size and alignment. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.function"> + <title><link linkend="boost_typetraits.category.function"> Decomposing Function + Types</link></title> + <para> + The class template <link linkend="boost_typetraits.reference.function_traits">function_traits</link> + extracts information from function types (see also <link linkend="boost_typetraits.reference.is_function">is_function</link>). + This traits class allows you to tell how many arguments a function takes, + what those argument types are, and what the return type is. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.function_traits">function_traits</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.user_defined"> + <title><link linkend="boost_typetraits.user_defined"> User Defined Specializations</link></title> + <para> + Occationally the end user may need to provide their own specialization for + one of the type traits - typically where intrinsic compiler support is required + to implement a specific trait fully. These specializations should derive from + boost::<link linkend="boost_typetraits.reference.integral_constant">true_type</link> + or boost::<link linkend="boost_typetraits.reference.integral_constant">false_type</link> + as appropriate: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> + +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_pod</phrase><phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_union</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">char</phrase> <phrase role="identifier">c</phrase><phrase role="special">;</phrase> + <phrase role="keyword">int</phrase> <phrase role="identifier">i</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">namespace</phrase> <phrase role="identifier">boost</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_pod</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.intrinsics"> + <title><link linkend="boost_typetraits.intrinsics"> Support for Compiler Intrinsics</link></title> + <para> + There are some traits that can not be implemented within the current C++ language: + to make these traits "just work" with user defined types, some kind + of additional help from the compiler is required. Currently (April 2008) Visual + C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other + compilers will no doubt follow in due course. + </para> + <para> + The Following traits classes always need compiler support to do the right thing + for all types (but all have safe fallback positions if this support is unavailable): + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_union">is_union</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_pod">is_pod</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link> + </listitem> + </itemizedlist> + <para> + The following traits classes can't be portably implemented in the C++ language, + although in practice, the implementations do in fact do the right thing on + all the compilers we know about: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_empty">is_empty</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link> + </listitem> + </itemizedlist> + <para> + The following traits classes are dependent on one or more of the above: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_class">is_class</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link> + </listitem> + </itemizedlist> + <para> + The hooks for compiler-intrinsic support are defined in <ulink url="../../../../boost/type_traits/intrinsics.hpp">boost/type_traits/intrinsics.hpp</ulink>, + adding support for new compilers is simply a matter of defining one of more + of the following macros: + </para> + <table frame="all"> <title>Macros for Compiler Intrinsics</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + BOOST_IS_UNION(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a union type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + BOOST_IS_POD(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a POD type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_EMPTY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an empty struct or union + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if the default constructor for T is trivial (i.e. + has no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial copy constructor (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial assignment operator (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial destructor (i.e. ~T() has + no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">x</phrase><phrase role="special">;</phrase></computeroutput> + can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">(</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">t</phrase><phrase role="special">,</phrase> + <phrase role="identifier">u</phrase><phrase role="special">;</phrase> + <phrase role="identifier">t</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">u</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_VIRTUAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true T has a virtual destructor + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ABSTRACT(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an abstract type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_BASE_OF(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a base class of U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CLASS(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a class type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CONVERTIBLE(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is convertible to U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ENUM(T) + </para> + </entry><entry> + <para> + Should evaluate to true is T is an enum + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_POLYMORPHIC(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a polymorphic type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_ALIGNMENT_OF(T) + </para> + </entry><entry> + <para> + Should evaluate to the alignment requirements of type T. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.mpl"> + <title><link linkend="boost_typetraits.mpl"> MPL Interoperability</link></title> + <para> + All the value based traits in this library conform to MPL's requirements for + an <ulink url="../../../../libs/mpl/doc/refmanual/integral-constant.html">Integral + Constant type</ulink>: that includes a number of rather intrusive workarounds + for broken compilers. + </para> + <para> + Purely as an implementation detail, this means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">true_</phrase></computeroutput></ulink>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">false_</phrase></computeroutput></ulink>, + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> + <phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/integral-c.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">integral_c</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput></ulink> + (provided <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>) + </para> + </section> + <section id="boost_typetraits.examples"> + <title><link linkend="boost_typetraits.examples"> Examples</link></title> + <section id="boost_typetraits.examples.copy"> + <title><link linkend="boost_typetraits.examples.copy"> An Optimized Version + of std::copy</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">copy</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + to optimise the copy operation (see <ulink url="../../examples/copy_example.cpp">copy_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// opt::copy +</phrase><phrase role="comment">// same semantics as std::copy +</phrase><phrase role="comment">// calls memcpy where appropriate. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="identifier">I2</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">out</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">out</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">memcpy</phrase><phrase role="special">(</phrase><phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="special">(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">)*</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">));</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">+(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can copy with memcpy if T has a trivial assignment operator, +</phrase> <phrase role="comment">// and if the iterator arguments are actually pointers (this last +</phrase> <phrase role="comment">// requirement we detect with overload resolution): +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">value_type</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.fill"> + <title><link linkend="boost_typetraits.examples.fill"> An Optimised Version + of std::fill</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">fill</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memset</phrase></computeroutput> + to optimise the fill operation (see <ulink url="../../examples/fill_example.cpp">fill_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// fill +</phrase><phrase role="comment">// same as std::fill, but uses memset where appropriate +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">first</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">memset</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can do an optimised fill if T has a trivial assignment +</phrase> <phrase role="comment">// operator and if it's size is one: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> <phrase role="special">&&</phrase> <phrase role="special">(</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase> <phrase role="special">==</phrase> <phrase role="number">1</phrase><phrase role="special">)></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.destruct"> + <title><link linkend="boost_typetraits.examples.destruct"> An Example that + Omits Destructor Calls For Types with Trivial Destructors</link></title> + <para> + Demonstrates a simple algorithm that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">__has_trivial_destruct</phrase></computeroutput> + to determine whether to destructors need to be called (see <ulink url="../../examples/trivial_destructor_example.cpp">trivial_destructor_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// algorithm destroy_array: +</phrase><phrase role="comment">// The reverse of std::unitialized_copy, takes a block of +</phrase><phrase role="comment">// initialized memory and calls destructors on all objects therein. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="identifier">first</phrase><phrase role="special">->~</phrase><phrase role="identifier">T</phrase><phrase role="special">();</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> <phrase role="comment">// namespace detail +</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p2</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">p2</phrase><phrase role="special">,</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.iter"> + <title><link linkend="boost_typetraits.examples.iter"> An improved Version + of std::iter_swap</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + that use type traits to determine whether an it's arguments are proxying + iterators or not, if they're not then it just does a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase></computeroutput> + of it's dereferenced arguments (the same as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + does), however if they are proxying iterators then takes special care over + the swap to ensure that the algorithm works correctly for both proxying iterators, + and even iterators of different types (see <ulink url="../../examples/iter_swap_example.cpp">iter_swap_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// iter_swap: +</phrase><phrase role="comment">// tests whether iterator is a proxying iterator or not, and +</phrase><phrase role="comment">// uses optimal form accordingly: +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">v_t</phrase><phrase role="special">;</phrase> + <phrase role="identifier">v_t</phrase> <phrase role="identifier">v</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">one</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">one</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">two</phrase> <phrase role="special">=</phrase> <phrase role="identifier">v</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">using</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase><phrase role="special">;</phrase> + <phrase role="identifier">swap</phrase><phrase role="special">(*</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">iter_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">two</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// See is both arguments are non-proxying iterators, +</phrase> <phrase role="comment">// and if both iterator the same type: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r1_t</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I2</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">;</phrase> + + <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.to_double"> + <title><link linkend="boost_typetraits.examples.to_double"> Convert Numeric + Types and Enums to double</link></title> + <para> + Demonstrates a conversion of <ulink url="../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric + Types</ulink> and enum types to double: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">double</phrase> <phrase role="identifier">to_double</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">value</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">promoted</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric</phrase><phrase role="special">::</phrase><phrase role="identifier">converter</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase><phrase role="identifier">promoted</phrase><phrase role="special">>::</phrase><phrase role="identifier">convert</phrase><phrase role="special">(</phrase><phrase role="identifier">value</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.reference"> + <title><link linkend="boost_typetraits.reference"> Alphabetical Reference</link></title> + <section id="boost_typetraits.reference.add_const"> + <title><link linkend="boost_typetraits.reference.add_const"> add_const</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_cv"> + <title><link linkend="boost_typetraits.reference.add_cv"> add_cv</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + <tertiary>three</tertiary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_pointer"> + <title><link linkend="boost_typetraits.reference.add_pointer"> add_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + <para> + The rationale for this template is that it produces the same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">TYPEOF</phrase><phrase role="special">(&</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput>, where + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">t</phrase></computeroutput> is an object of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_reference"> + <title><link linkend="boost_typetraits.reference.add_reference"> add_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is not a reference type then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">&</phrase></computeroutput>, otherwise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_volatile"> + <title><link linkend="boost_typetraits.reference.add_volatile"> add_volatile</link></title> + <indexterm type="class_name"> + <primary>one</primary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.aligned_storage"> + <title><link linkend="boost_typetraits.reference.aligned_storage"> aligned_storage</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">aligned_storage</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with size + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Size</phrase></computeroutput> and an alignment that + is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">aligned_storage</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.alignment_of"> + <title><link linkend="boost_typetraits.reference.alignment_of"> alignment_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">alignment_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template alignment<emphasis role="underline">of inherits from `</emphasis>_integral_constant<std::size_t, + ALIGNOF(T)><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">,</phrase> <phrase role="identifier">where</phrase> + </computeroutput>ALIGNOF(T)` is the alignment of type T. + </para> + <para> + <emphasis>Note: strictly speaking you should only rely on the value of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> being + a multiple of the true alignment of T, although in practice it does compute + the correct value in all the cases we know about.</emphasis> + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">alignment_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">char</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + with value <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.decay"> + <title><link linkend="boost_typetraits.reference.decay"> decay</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">decay</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> Let <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + be the result of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput>, then if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + is an array type, the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>*</phrase></computeroutput>, + otherwise if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> is a function + type then the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase><phrase role="special">*</phrase></computeroutput>, otherwise the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">decay</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.extent"> + <title><link linkend="boost_typetraits.reference.extent"> extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">extent</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template extent inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is the number of elements in the N'th array + dimention of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">N</phrase> <phrase role="special">></phrase> + <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput>, or if the N'th array bound is incomplete, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">],</phrase> + <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>4</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">],</phrase> <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.floating_point_promotion"> + <title><link linkend="boost_typetraits.reference.floating_point_promotion"> + floating_point_promotion</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">floating_point_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If floating point promotion can be + applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies floating point promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">float</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.function_traits"> + <title><link linkend="boost_typetraits.reference.function_traits"> function_traits</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">F</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">function_traits</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">arity</phrase> <phrase role="special">=</phrase> <replaceable>see-below</replaceable><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">result_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> arg<replaceable>N</replaceable>_type<phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + The class template function_traits will only compile if: + </para> + <itemizedlist> + <listitem> + The compiler supports partial specialization of class templates. + </listitem> + <listitem> + The template argument <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput> + is a <emphasis>function type</emphasis>, note that this <emphasis><emphasis role="bold">is not</emphasis></emphasis> the same thing as a <emphasis>pointer + to a function</emphasis>. + </listitem> + </itemizedlist> + <tip> + <para> + function_traits is intended to introspect only C++ functions of the form + R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member + functions. To convert a function pointer type to a suitable type use <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link>. + </para> + </tip> + <table frame="all"> <title>Function Traits Members</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Member + </para> + </entry><entry> + <para> + Description + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that gives the number of arguments + accepted by the function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type returned by function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase>arg<replaceable>N</replaceable>_type</computeroutput> + </para> + </entry><entry> + <para> + The <replaceable>N</replaceable>th argument type of function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="number">1</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">N</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">arity</phrase></computeroutput> of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 0. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 1. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 4. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">long</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arg1_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg4_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg5_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: there is no <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">arg5_type</phrase></computeroutput> + since there are only four arguments. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: argument type is a <emphasis>function pointer</emphasis>, + and not a <emphasis>function type</emphasis>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.has_nothrow_assign"> + <title><link linkend="boost_typetraits.reference.has_nothrow_assign"> has_nothrow_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_assign</phrase></computeroutput> + will never report that a class or struct has a non-throwing assignment-operator; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler support to ensure that this trait "just + works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_constructor"> + <title><link linkend="boost_typetraits.reference.has_nothrow_constructor"> + has_nothrow_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_constructor</phrase></computeroutput> + will never report that a class or struct has a non-throwing default-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_copy"> + <title><link linkend="boost_typetraits.reference.has_nothrow_copy"> has_nothrow_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_copy</phrase></computeroutput> + will never report that a class or struct has a non-throwing copy-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_nothrow_cp_cons"> has_nothrow_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_no_throw_def_cons"> + <title><link linkend="boost_typetraits.reference.has_no_throw_def_cons"> has_nothrow_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_assign"> + <title><link linkend="boost_typetraits.reference.has_trivial_assign"> has_trivial_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial assignment-operator then the operator has the same + effect as copying the bits of one object to the other: calls to the operator + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_assign + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p11. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_constructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_constructor"> + has_trivial_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial default-constructor then the constructor have no + effect: calls to the constructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_constructor + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.1p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_copy"> + <title><link linkend="boost_typetraits.reference.has_trivial_copy"> has_trivial_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial copy-constructor then the constructor has the same + effect as copying the bits of one object to the other: calls to the constructor + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_copy + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_cp_cons"> has_trivial_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_def_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_def_cons"> has_trivial_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_destructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_destructor"> has_trivial_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial destructor then the destructor has no effect: calls + to the destructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_destructor + will never report that a user-defined class or struct has a trivial destructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4p3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_virtual_destructor"> + <title><link linkend="boost_typetraits.reference.has_virtual_destructor"> has_virtual_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_virtual_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a virtual destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This trait is provided + for completeness, since it's part of the Technical Report on C++ Library + Extensions. However, there is currently no way to portably implement this + trait. The default version provided always inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + and has to be explicitly specialized for types with virtual destructors unless + the compiler used has compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + that enable the trait to do the right thing: currently (May 2005) only Visual + C++ 8 and GCC-4.3 have the necessary <link linkend="boost_typetraits.intrinsics">intrinsics</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_virtual_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.integral_constant"> + <title><link linkend="boost_typetraits.reference.integral_constant"> integral_constant</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_constant</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">true</phrase><phrase role="special">></phrase> <phrase role="identifier">true_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">false</phrase><phrase role="special">></phrase> <phrase role="identifier">false_type</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + Class template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_constant</phrase></computeroutput> + is the common base class for all the value-based type traits. The two typedef's + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">true_type</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">false_type</phrase></computeroutput> are provided for convenience: + most of the value traits are Boolean properties and so will inherit from + one of these. + </para> + </section> + <section id="boost_typetraits.reference.integral_promotion"> + <title><link linkend="boost_typetraits.reference.integral_promotion"> integral_promotion</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral promotion can be applied + to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, then + applies integral promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field). + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">integral_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">enum</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">float_round_style</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.is_abstract"> + <title><link linkend="boost_typetraits.reference.is_abstract"> is_abstract</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_abstract</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + abstract type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_abstract</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The compiler must + support DR337 (as of April 2005: GCC 3.4, VC++ 7.1 (and later), Intel C++ + 7 (and later), and Comeau 4.3.2). Otherwise behaves the same as <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>; + this is the "safe fallback position" for which polymorphic types + are always regarded as potentially abstract. The macro BOOST_NO_IS_ABSTRACT + is used to signify that the implementation is buggy, users should check for + this in their own code if the "safe fallback" is not suitable for + their particular use-case. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">abc</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">abc</phrase><phrase role="special">()</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_arithmetic"> + <title><link linkend="boost_typetraits.reference.is_arithmetic"> is_arithmetic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_arithmetic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + arithmetic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Arithmetic types include integral and floating point types (see also <link linkend="boost_typetraits.reference.is_integral">is_integral</link> and + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_arithmetic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_array"> + <title><link linkend="boost_typetraits.reference.is_array"> is_array</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_array</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + array type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_array</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can give the wrong result with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_base_of"> + <title><link linkend="boost_typetraits.reference.is_base_of"> is_base_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_base_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If Base is base class of type + Derived or if both types are the same then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + This template will detect non-public base classes, and ambiguous base classes. + </para> + <para> + Note that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">X</phrase><phrase role="special">,</phrase><phrase role="identifier">X</phrase><phrase role="special">></phrase></computeroutput> will always inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>. + <emphasis role="bold">This is the case even if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">X</phrase></computeroutput> + is not a class type</emphasis>. This is a change in behaviour from Boost-1.33 + in order to track the Technical Report on C++ Library Extensions. + </para> + <para> + Types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput> must not be incomplete types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_base_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. There are some older compilers which + will produce compiler errors if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> + is a private base class of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> is an ambiguous + base of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>. These compilers + include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and + older versions of EDG based compilers. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase> <phrase role="special">:</phrase> + <phrase role="keyword">public</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Base</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>: a class is regarded as it's + own base. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_class"> + <title><link linkend="boost_typetraits.reference.is_class"> is_class</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_class</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + class type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types, as a result this type will erroneously inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> for + union types. See also <link linkend="boost_typetraits.reference.is_union">is_union</link>. + Currently (May 2005) only Visual C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to correctly identify union types, and therefore make is_class function correctly. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">MyClass</phrase><phrase role="special">;</phrase></computeroutput> then: + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_complex"> + <title><link linkend="boost_typetraits.reference.is_complex"> is_complex</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_complex</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is a complex number type then true (of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">complex</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">></phrase></computeroutput> + for some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>), otherwise + false. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 26.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_complex</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.is_compound"> + <title><link linkend="boost_typetraits.reference.is_compound"> is_compound</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_compound</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + compound type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Any type that is not a fundamental type is a compound type (see also <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_compound</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyEnum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_const"> + <title><link linkend="boost_typetraits.reference.is_const"> is_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_const</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) const-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_convertible"> + <title><link linkend="boost_typetraits.reference.is_convertible"> is_convertible</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_convertible</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If an imaginary lvalue of type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> is convertible to type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type From must not be an incomplete type. + </para> + <para> + Type To must not be an incomplete, or function type. + </para> + <para> + No types are considered to be convertible to array types or abstract-class + types. + </para> + <para> + This template can not detect whether a converting-constructor is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> or not: if type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">private</phrase></computeroutput> converting constructor + from type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> then instantiating + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase></computeroutput> + will produce a compiler error. For this reason <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase></computeroutput> + can not be used to determine whether a type has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> + copy-constructor or not. + </para> + <para> + This template will also produce compiler errors if the conversion is ambiguous, + for example: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">B</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">C</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">D</phrase> <phrase role="special">:</phrase> <phrase role="identifier">B</phrase><phrase role="special">,</phrase> <phrase role="identifier">C</phrase> <phrase role="special">{};</phrase> +<phrase role="comment">// This produces a compiler error, the conversion is ambiguous: +</phrase><phrase role="keyword">bool</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">D</phrase><phrase role="special">*,</phrase><phrase role="identifier">A</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4 and 8.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This template is + currently broken with Borland C++ Builder 5 (and earlier), for constructor-based + conversions, and for the Metrowerks 7 (and earlier) compiler in all cases. + If the compiler does not support <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_abstract">is_abstract</link></computeroutput>, + then the template parameter <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + must not be an abstract type. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the conversion would require a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const_cast</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&,</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_empty"> + <title><link linkend="boost_typetraits.reference.is_empty"> is_empty</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_empty</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an empty class type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10p5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> In order to correctly + detect empty classes this trait relies on either: + </para> + <itemizedlist> + <listitem> + the compiler implementing zero sized empty base classes, or + </listitem> + <listitem> + the compiler providing <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect empty classes. + </listitem> + </itemizedlist> + <para> + Can not be used with incomplete types. + </para> + <para> + Can not be used with union types, until is_union can be made to work. + </para> + <para> + If the compiler does not support partial-specialization of class templates, + then this template can not be used with abstract types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">empty_class</phrase> + <phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_enum"> + <title><link linkend="boost_typetraits.reference.is_enum"> is_enum</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_enum</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + enum type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_enum</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Requires a correctly + functioning <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template; this means that is_enum is currently broken under Borland C++ Builder + 5, and for the Metrowerks compiler prior to version 8, other compilers should + handle this template just fine. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">enum</phrase> <phrase role="identifier">my_enum</phrase> + <phrase role="special">{</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_floating_point"> + <title><link linkend="boost_typetraits.reference.is_floating_point"> is_floating_point</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_floating_point</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + floating point type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_floating_point</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_function"> + <title><link linkend="boost_typetraits.reference.is_function"> is_function</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_function</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + function type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Note that this template does not detect <emphasis>pointers to functions</emphasis>, + or <emphasis>references to functions</emphasis>, these are detected by <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> and <link linkend="boost_typetraits.reference.is_reference">is_reference</link> respectively: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="identifier">f1</phrase><phrase role="special">();</phrase> <phrase role="comment">// f1 is of function type. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f2</phrase><phrase role="special">*)();</phrase> <phrase role="comment">// f2 is a pointer to a function. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f3</phrase><phrase role="special">&)();</phrase> <phrase role="comment">// f3 is a reference to a function. +</phrase></programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p1 and 8.3.5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_function</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer type, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a reference to a function, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer to a member function. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <tip> + <para> + Don't confuse function-types with pointers to functions: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> + <phrase role="identifier">f</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">);</phrase></computeroutput> + </para> + <para> + defines a function type, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase> <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a prototype for a function of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase></computeroutput>, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">*</phrase> + <phrase role="identifier">pf</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">&</phrase> + <phrase role="identifier">fr</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a pointer and a reference to the function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">foo</phrase></computeroutput>. + </para> + <para> + If you want to detect whether some type is a pointer-to-function then use: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special"><</phrase><link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + </para> + <para> + or for pointers to member functions you can just use <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + directly. + </para> + </tip> + </section> + <section id="boost_typetraits.reference.is_fundamental"> + <title><link linkend="boost_typetraits.reference.is_fundamental"> is_fundamental</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_fundamental</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + fundamental type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Fundamental types include integral, floating point and void types (see also + <link linkend="boost_typetraits.reference.is_integral">is_integral</link>, + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link> + and <link linkend="boost_typetraits.reference.is_void">is_void</link>) + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_fundamental</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_integral"> + <title><link linkend="boost_typetraits.reference.is_integral"> is_integral</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_integral</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + integral type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p7. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_integral</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_function_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_function_pointer"> + is_member_function_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_function_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member function then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a data member and not a member + function, see <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_object_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_object_pointer"> + is_member_object_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_object_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member object (a data member) then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a member function and not a + member object, see <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_pointer"> is_member_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member (either a function or a data member) then inherits from + <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_object"> + <title><link linkend="boost_typetraits.reference.is_object"> is_object</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_object</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + object type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + All types are object types except references, void, and function types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_object</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: reference types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: function types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + void is not an object type + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pod"> + <title><link linkend="boost_typetraits.reference.is_pod"> is_pod</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pod</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + POD type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + POD stands for "Plain old data". Arithmetic types, and enumeration + types, a pointers and pointer to members are all PODs. Classes and unions + can also be POD's if they have no non-static data members that are of reference + or non-POD type, no user defined constructors, no user defined assignment + operators, no private or protected non-static data members, no virtual functions + and no base classes. Finally, a cv-qualified POD is still a POD, as is an + array of PODs. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10 and 9p4 (Note + that POD's are also aggregates, see 8.5.1). + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is<emphasis role="underline">pod + will never report that a class or struct is a POD; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler-</emphasis>_intrinsics. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pointer"> + <title><link linkend="boost_typetraits.reference.is_pointer"> is_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer type (includes function pointers, but excludes pointers to members) + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p2 and 8.3.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <important> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> detects "real" + pointer types only, and <emphasis>not</emphasis> smart pointers. Users + should not specialise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> + for smart pointer types, as doing so may cause Boost (and other third party) + code to fail to function correctly. Users wanting a trait to detect smart + pointers should create their own. However, note that there is no way in + general to auto-magically detect smart pointer types, so such a trait would + have to be partially specialised for each supported smart pointer type. + </para> + </important> + </section> + <section id="boost_typetraits.reference.is_polymorphic"> + <title><link linkend="boost_typetraits.reference.is_polymorphic"> is_polymorphic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_polymorphic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + polymorphic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The implementation + requires some knowledge of the compilers ABI, it does actually seem to work + with the majority of compilers though. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_polymorphic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">poly</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">poly</phrase><phrase role="special">();</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_same"> + <title><link linkend="boost_typetraits.reference.is_same"> is_same</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_same</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T and U are the same types + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_same</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with abstract, incomplete or function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_scalar"> + <title><link linkend="boost_typetraits.reference.is_scalar"> is_scalar</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_scalar</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + scalar type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Scalar types include integral, floating point, enumeration, pointer, and + pointer-to-member types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_scalar</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_signed"> + <title><link linkend="boost_typetraits.reference.is_signed"> is_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_signed</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an signed integer type + or an enumerated type with an underlying signed integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_stateless"> + <title><link linkend="boost_typetraits.reference.is_stateless"> is_stateless</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_stateless</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Ff T is a stateless type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type T must be a complete type. + </para> + <para> + A stateless type is a type that has no storage and whose constructors and + destructors are trivial. That means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_stateless</phrase></computeroutput> + only inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the following expression is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">true</phrase></computeroutput>: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_stateless</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is_stateless will + never report that a class or struct is stateless; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this template work automatically. + </para> + </section> + <section id="boost_typetraits.reference.is_reference"> + <title><link linkend="boost_typetraits.reference.is_reference"> is_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_reference</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a reference pointer type + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + may report the wrong result for function types, and for types that are both + const and volatile qualified. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis> (the argument in this case + is a reference to a function). + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_union"> + <title><link linkend="boost_typetraits.reference.is_union"> is_union</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_union</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + union type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Currently requires some kind of compiler support, otherwise unions are identified + as classes. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types using only standard C++, as a result this type will never + inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + unless the user explicitly specializes the template for their user-defined + union types, or unless the compiler supplies some unspecified intrinsic that + implements this functionality. Currently (May 2005) only Visual C++ 8 has + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this trait "just work" without user intervention. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_unsigned"> + <title><link linkend="boost_typetraits.reference.is_unsigned"> is_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_unsigned</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an unsigned integer type + or an enumerated type with an underlying unsigned integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_void"> + <title><link linkend="boost_typetraits.reference.is_void"> is_void</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_void</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + void type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_void</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_volatile"> + <title><link linkend="boost_typetraits.reference.is_volatile"> is_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_volatile</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) volatile-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">volatile</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase> + <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the volatile qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.make_signed"> + <title><link linkend="boost_typetraits.reference.make_signed"> make_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_signed</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a signed integer type then + the same type as T, if T is an unsigned integer type then the corresponding + signed type. Otherwise if T is an enumerated or character type (char or wchar_t) + then a signed integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.make_unsigned"> + <title><link linkend="boost_typetraits.reference.make_unsigned"> make_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_unsigned</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a unsigned integer type then + the same type as T, if T is an signed integer type then the corresponding + unsigned type. Otherwise if T is an enumerated or character type (char or + wchar_t) then an unsigned integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.promote"> + <title><link linkend="boost_typetraits.reference.promote"> promote</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">promote</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral or floating point promotion + can be applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies integral and floating point promotions to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + See also <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link> + and <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field) and 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">promote</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.rank"> + <title><link linkend="boost_typetraits.reference.rank"> rank</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">rank</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template rank inherits from + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is the + number of array dimensions in type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">rank</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[]></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>1</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.remove_all_extents"> + <title><link linkend="boost_typetraits.reference.remove_all_extents"> remove_all_extents</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_all_extents</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes all of the array bounds on <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_all_extents</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_const"> + <title><link linkend="boost_typetraits.reference.remove_const"> remove_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> const-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_cv"> + <title><link linkend="boost_typetraits.reference.remove_cv"> remove_cv</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> cv-qualifiers removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_extent"> + <title><link linkend="boost_typetraits.reference.remove_extent"> remove_extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_extent</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes the topmost array bound, otherwise leaves + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_pointer"> + <title><link linkend="boost_typetraits.reference.remove_pointer"> remove_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any pointer modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">**>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_reference"> + <title><link linkend="boost_typetraits.reference.remove_reference"> remove_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any reference modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_volatile"> + <title><link linkend="boost_typetraits.reference.remove_volatile"> remove_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> volatile-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.type_with_alignment"> + <title><link linkend="boost_typetraits.reference.type_with_alignment"> type_with_alignment</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">type_with_alignment</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with an alignment + that is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">type_with_alignment</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + </section> + <section id="boost_typetraits.credits"> + <title><link linkend="boost_typetraits.credits"> Credits</link></title> + <para> + This documentation was pulled together by John Maddock, using <ulink url="../../../../doc/html/quickbook.html">Boost.Quickbook</ulink> + and <ulink url="../../../../doc/html/boostbook.html">Boost.DocBook</ulink>. + </para> + <para> + The original version of this library was created by Steve Cleary, Beman Dawes, + Howard Hinnant, and John Maddock. John Maddock is the current maintainer of + the library. + </para> + <para> + This version of type traits library is based on contributions by Adobe Systems + Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, + Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert + Ramey and Jeremy Siek. + </para> + <para> + Mat Marcus and Jesse Jones invented, and <ulink url="http://opensource.adobe.com/project4/project.shtml">published + a paper describing</ulink>, the partial specialization workarounds used in + this library. + </para> + <para> + Aleksey Gurtovoy added MPL integration to the library. + </para> + <para> + The <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template is based on code originally devised by Andrei Alexandrescu, see "<ulink url="http://www.cuj.com/experts/1810/alexandr.htm?topic=experts">Generic<Programming>: + Mappings between Types and Values</ulink>". + </para> + <para> + The latest version of this library and documentation can be found at <ulink url="http://www.boost.org">www.boost.org</ulink>. Bugs, suggestions and discussion + should be directed to boost@lists.boost.org (see <ulink url="http://www.boost.org/more/mailing_lists.htm#main">www.boost.org/more/mailing_lists.htm#main</ulink> + for subscription details). + </para> + </section> + + <section id="boost_typetraits.ignored_section"> + <title>This section must not be indexed.</title> + <?BoostAutoIndex IgnoreSection?> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + <section id="boost_typetraits.ignored_block"> + <title>This section contains one block that must not be indexed and one that should be.</title> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + <?BoostAutoIndex IgnoreBlock?> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + + <section> + <title>Class Index</title> + <para><link linkend="idx_id_0">A</link> <link linkend="idx_id_2">C</link> <link linkend="idx_id_3">D</link> <link linkend="idx_id_4">E</link> <link linkend="idx_id_5">F</link> <link linkend="idx_id_6">H</link> <link linkend="idx_id_7">I</link> <link linkend="idx_id_8">M</link> <link linkend="idx_id_9">O</link> <link linkend="idx_id_10">P</link> <link linkend="idx_id_11">R</link> <link linkend="idx_id_13">T</link></para><variablelist><varlistentry id="idx_id_0"><term>A</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-0">add_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-0">add_cv</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_pointer"><phrase role="index-entry-level-0">add_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_reference"><phrase role="index-entry-level-0">add_reference</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">add_volatile</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">This section contains one block that must not be indexed and one that should be.</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.aligned_storage"><phrase role="index-entry-level-0">aligned_storage</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-0">alignment_of</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_2"><term>C</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Constrained Index Term</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_3"><term>D</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.decay"><phrase role="index-entry-level-0">decay</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_4"><term>E</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-0">extent</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_5"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.floating_point_promotion"><phrase role="index-entry-level-0">floating_point_promotion</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-0">function_traits</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_6"><term>H</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_assign"><phrase role="index-entry-level-0">has_nothrow_assign</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-0">has_nothrow_constructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-0">has_nothrow_copy</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_assign"><phrase role="index-entry-level-0">has_trivial_assign</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-0">has_trivial_constructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-0">has_trivial_copy</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_destructor"><phrase role="index-entry-level-0">has_trivial_destructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_virtual_destructor"><phrase role="index-entry-level-0">has_virtual_destructor</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_7"><term>I</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">integral_constant</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_promotion"><phrase role="index-entry-level-0">integral_promotion</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_abstract"><phrase role="index-entry-level-0">is_abstract</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_arithmetic"><phrase role="index-entry-level-0">is_arithmetic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_array"><phrase role="index-entry-level-0">is_array</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_base_of"><phrase role="index-entry-level-0">is_base_of</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_class</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_class"><phrase role="index-entry-level-1">is_class</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_complex"><phrase role="index-entry-level-0">is_complex</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_compound"><phrase role="index-entry-level-0">is_compound</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_const"><phrase role="index-entry-level-0">is_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_convertible"><phrase role="index-entry-level-0">is_convertible</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_empty"><phrase role="index-entry-level-0">is_empty</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_enum"><phrase role="index-entry-level-0">is_enum</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_floating_point"><phrase role="index-entry-level-0">is_floating_point</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-0">is_function</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_fundamental"><phrase role="index-entry-level-0">is_fundamental</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_integral"><phrase role="index-entry-level-0">is_integral</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_function_pointer"><phrase role="index-entry-level-0">is_member_function_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_object_pointer"><phrase role="index-entry-level-0">is_member_object_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_pointer"><phrase role="index-entry-level-0">is_member_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_object"><phrase role="index-entry-level-0">is_object</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_pod</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pod"><phrase role="index-entry-level-1">is_pod</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">is_pointer</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pointer"><phrase role="index-entry-level-1">is_pointer</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_polymorphic"><phrase role="index-entry-level-0">is_polymorphic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_reference"><phrase role="index-entry-level-0">is_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_same"><phrase role="index-entry-level-0">is_same</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_scalar"><phrase role="index-entry-level-0">is_scalar</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_signed"><phrase role="index-entry-level-0">is_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_stateless"><phrase role="index-entry-level-0">is_stateless</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_union</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_union"><phrase role="index-entry-level-1">is_union</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_unsigned"><phrase role="index-entry-level-0">is_unsigned</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_void</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_void"><phrase role="index-entry-level-1">is_void</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_volatile"><phrase role="index-entry-level-0">is_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_8"><term>M</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.make_signed"><phrase role="index-entry-level-0">make_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.make_unsigned"><phrase role="index-entry-level-0">make_unsigned</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_9"><term>O</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">one</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-1">two</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-2">add_const</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-2">three</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-3">add_cv</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_10"><term>P</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.promote"><phrase role="index-entry-level-0">promote</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_11"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-0">rank</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_all_extents"><phrase role="index-entry-level-0">remove_all_extents</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_const"><phrase role="index-entry-level-0">remove_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_cv"><phrase role="index-entry-level-0">remove_cv</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">remove_extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.remove_extent"><phrase role="index-entry-level-1">remove_extent</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_pointer"><phrase role="index-entry-level-0">remove_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_reference"><phrase role="index-entry-level-0">remove_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_volatile"><phrase role="index-entry-level-0">remove_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_13"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.type_with_alignment"><phrase role="index-entry-level-0">type_with_alignment</phrase></link></para></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + <section> + <title>Typedef Index</title> + <para><link linkend="idx_id_20">F</link> <link linkend="idx_id_26">R</link> <link linkend="idx_id_28">T</link></para><variablelist><varlistentry id="idx_id_20"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">false_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_26"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">result_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_28"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">true_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + <section> + <title>Macro Index</title> + <para><link linkend="idx_id_31">B</link></para><variablelist><varlistentry id="idx_id_31"><term>B</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">BOOST_ALIGNMENT_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">Type Traits that Transform One Type to Another</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ABSTRACT</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_BASE_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CLASS</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CONVERTIBLE</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_EMPTY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ENUM</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POD</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POLYMORPHIC</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_UNION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + <section> + <title>Index Test 1</title> + <para><link linkend="idx_id_58">T</link></para><variablelist><varlistentry id="idx_id_58"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">Introduction</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + <section> + <title>Index Test 2</title> + <para><link linkend="idx_id_73">T</link></para><variablelist><varlistentry id="idx_id_73"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + <section><title>Index</title><para><link linkend="idx_id_75">A</link> <link linkend="idx_id_76">B</link> <link linkend="idx_id_77">C</link> <link linkend="idx_id_78">D</link> <link linkend="idx_id_79">E</link> <link linkend="idx_id_80">F</link> <link linkend="idx_id_81">H</link> <link linkend="idx_id_82">I</link> <link linkend="idx_id_83">M</link> <link linkend="idx_id_84">O</link> <link linkend="idx_id_85">P</link> <link linkend="idx_id_86">R</link> <link linkend="idx_id_87">S</link> <link linkend="idx_id_88">T</link> <link linkend="idx_id_89">U</link></para><variablelist><varlistentry id="idx_id_75"><term>A</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">add_const</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">Constrained Index Term</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-0">add_cv</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_pointer"><phrase role="index-entry-level-0">add_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_reference"><phrase role="index-entry-level-0">add_reference</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">add_volatile</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">This section contains one block that must not be indexed and one that should be.</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.aligned_storage"><phrase role="index-entry-level-0">aligned_storage</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">alignment_of</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_76"><term>B</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Background and Tutorial</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">is_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">is_void</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">remove_extent</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">type-traits</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_ALIGNMENT_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">Type Traits that Transform One Type to Another</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ABSTRACT</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_BASE_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CLASS</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CONVERTIBLE</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_EMPTY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ENUM</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POD</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POLYMORPHIC</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_UNION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_77"><term>C</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Constrained Index Term</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_78"><term>D</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.decay"><phrase role="index-entry-level-0">decay</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_79"><term>E</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_80"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">false_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.floating_point_promotion"><phrase role="index-entry-level-0">floating_point_promotion</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">Foo1</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">Foo2</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-1">Bar2</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.value_traits"><phrase role="index-entry-level-2">Type Traits that Describe the Properties of a Type</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">function_traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">result_type</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_81"><term>H</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_assign"><phrase role="index-entry-level-0">has_nothrow_assign</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_default_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_assign"><phrase role="index-entry-level-0">has_trivial_assign</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_default_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_destructor"><phrase role="index-entry-level-0">has_trivial_destructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_virtual_destructor"><phrase role="index-entry-level-0">has_virtual_destructor</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_82"><term>I</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">int</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">is_function</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">integral_constant</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">false_type</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">true_type</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_promotion"><phrase role="index-entry-level-0">integral_promotion</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">Introduction</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">type-traits</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_abstract"><phrase role="index-entry-level-0">is_abstract</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_arithmetic"><phrase role="index-entry-level-0">is_arithmetic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_array"><phrase role="index-entry-level-0">is_array</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_base_of"><phrase role="index-entry-level-0">is_base_of</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_class</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_class"><phrase role="index-entry-level-1">is_class</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_complex"><phrase role="index-entry-level-0">is_complex</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_compound"><phrase role="index-entry-level-0">is_compound</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_const"><phrase role="index-entry-level-0">is_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_convertible"><phrase role="index-entry-level-0">is_convertible</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_empty"><phrase role="index-entry-level-0">is_empty</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_enum"><phrase role="index-entry-level-0">is_enum</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_floating_point"><phrase role="index-entry-level-0">is_floating_point</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_function</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">int</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">is_function</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_fundamental"><phrase role="index-entry-level-0">is_fundamental</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_integral"><phrase role="index-entry-level-0">is_integral</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_function_pointer"><phrase role="index-entry-level-0">is_member_function_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_object_pointer"><phrase role="index-entry-level-0">is_member_object_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_pointer"><phrase role="index-entry-level-0">is_member_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_object"><phrase role="index-entry-level-0">is_object</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_pod</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pod"><phrase role="index-entry-level-1">is_pod</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">is_pointer</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pointer"><phrase role="index-entry-level-1">is_pointer</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_polymorphic"><phrase role="index-entry-level-0">is_polymorphic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_reference"><phrase role="index-entry-level-0">is_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_same"><phrase role="index-entry-level-0">is_same</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_scalar"><phrase role="index-entry-level-0">is_scalar</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_signed"><phrase role="index-entry-level-0">is_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_stateless"><phrase role="index-entry-level-0">is_stateless</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_union</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_union"><phrase role="index-entry-level-1">is_union</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_unsigned"><phrase role="index-entry-level-0">is_unsigned</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_void</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_void"><phrase role="index-entry-level-1">is_void</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_volatile"><phrase role="index-entry-level-0">is_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_83"><term>M</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.make_signed"><phrase role="index-entry-level-0">make_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.make_unsigned"><phrase role="index-entry-level-0">make_unsigned</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_84"><term>O</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">one</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-1">two</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-2">add_const</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-2">three</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-3">add_cv</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_85"><term>P</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.promote"><phrase role="index-entry-level-0">promote</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_86"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">rank</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_all_extents"><phrase role="index-entry-level-0">remove_all_extents</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_const"><phrase role="index-entry-level-0">remove_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_cv"><phrase role="index-entry-level-0">remove_cv</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">remove_extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.remove_extent"><phrase role="index-entry-level-1">remove_extent</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_pointer"><phrase role="index-entry-level-0">remove_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_reference"><phrase role="index-entry-level-0">remove_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_volatile"><phrase role="index-entry-level-0">remove_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">result_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_87"><term>S</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Support for Compiler Intrinsics</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_ALIGNMENT_OF</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_ASSIGN</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_COPY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_ASSIGN</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_COPY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_ABSTRACT</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_BASE_OF</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_CLASS</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_CONVERTIBLE</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_EMPTY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_ENUM</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_POD</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_POLYMORPHIC</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_UNION</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_88"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">This section contains one block that must not be indexed and one that should be.</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">true_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">Type Traits that Transform One Type to Another</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">Introduction</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.type_with_alignment"><phrase role="index-entry-level-0">type_with_alignment</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_89"><term>U</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">User Defined Specializations</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_class</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_pod</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_union</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></section> + +</chapter>
\ No newline at end of file diff --git a/tools/auto_index/test/test3.gold b/tools/auto_index/test/test3.gold new file mode 100644 index 0000000000..ad7affeb0a --- /dev/null +++ b/tools/auto_index/test/test3.gold @@ -0,0 +1,6671 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> +<!-- + +This file is based upon the type traits docs, but has had additional XML elements added to it +to ensure complete testing. + +--> + +<chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="boost_typetraits" rev:last-revision="$Date: 2008-11-28 12:41:45 +0000 (Fri, 28 Nov 2008) $"> + <chapterinfo><author> + <firstname>various</firstname> <surname>authors</surname> + </author><copyright> + <year>2000</year> <year>2006</year> <holder>Adobe Systems Inc, David Abrahams, + Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat + Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert + Ramey and Jeremy Siek</holder> + </copyright><legalnotice> + <para> + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) + </para> + </legalnotice></chapterinfo> + <title>Boost.TypeTraits</title> + <para> + A printer-friendly <ulink url="http://svn.boost.org/svn/boost/sandbox/pdf/type_traits/release/type_traits.pdf">PDF + version of this manual is also available</ulink>. + </para> + <section id="boost_typetraits.intro"> + <title><link linkend="boost_typetraits.intro"> Introduction</link></title> + <para> + The Boost type-traits library contains a set of very specific traits classes, + each of which encapsulate a single trait from the C++ type system; for example, + is a type a pointer or a reference type? Or does a type have a trivial constructor, + or a const-qualifier? + </para> + <para> + The type-traits classes share a unified design: each class inherits from a + the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. + </para> + </section> + <section id="boost_typetraits.background"> + <title><link linkend="boost_typetraits.background"> Background and Tutorial</link></title> + <para> + The following is an updated version of the article "C++ Type traits" + by John Maddock and Steve Cleary that appeared in the October 2000 issue of + <ulink url="http://www.ddj.com">Dr Dobb's Journal</ulink>. + </para> + <para> + Generic programming (writing code which works with any data type meeting a + set of requirements) has become the method of choice for providing reusable + code. However, there are times in generic programming when "generic" + just isn't good enough - sometimes the differences between types are too large + for an efficient generic implementation. This is when the traits technique + becomes important - by encapsulating those properties that need to be considered + on a type by type basis inside a traits class, we can minimize the amount of + code that has to differ from one type to another, and maximize the amount of + generic code. + </para> + <?dbfo keep-together="auto" ?> + <para> + <indexterm> + <primary>Foo1</primary> + </indexterm> + Consider an example: when working with character strings, one common operation + is to determine the length of a null terminated string. Clearly it's possible + to write generic code that can do this, but it turns out that there are much + more efficient methods available: for example, the C library functions <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">strlen</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">wcslen</phrase></computeroutput> + are usually written in assembler, and with suitable hardware support can be + considerably faster than a generic version written in C++. The authors of the + C++ standard library realized this, and abstracted the properties of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">wchar_t</phrase></computeroutput> + into the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput>. + Generic code that works with character strings can simply use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase><phrase role="special"><>::</phrase><phrase role="identifier">length</phrase></computeroutput> to determine the length of a null + terminated string, safe in the knowledge that specializations of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> will use the most appropriate + method available to them. + </para> + <anchor id="boost_typetraits.background.type_traits"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.type_traits">Type Traits</link> + </bridgehead> + <para> + Class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> is a classic + example of a collection of type specific properties wrapped up in a single + class - what Nathan Myers termed a <emphasis>baggage class</emphasis><link linkend="background.references">[1]</link>. In the Boost type-traits library, + we<link linkend="background.references">[2]</link> have written a set of very + specific traits classes, each of which encapsulate a single trait from the + C++ type system; for example, is a type a pointer or a reference type? Or does + a type have a trivial constructor, or a const-qualifier? The type-traits classes + share a unified design: each class inherits from a the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. As we will show, these classes can be used in generic programming + to determine the properties of a given type and introduce optimizations that + are appropriate for that case. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. All of the type-traits classes are + defined inside namespace <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase></computeroutput>; + for brevity, namespace-qualification is omitted in most of the code samples + given. + </para> + <anchor id="boost_typetraits.background.implementation"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.implementation">Implementation</link> + </bridgehead> + <para> + There are far too many separate classes contained in the type-traits library + to give a full implementation here - see the source code in the Boost library + for the full details - however, most of the implementation is fairly repetitive + anyway, so here we will just give you a flavor for how some of the classes + are implemented. Beginning with possibly the simplest class in the library, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput> inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + only if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + Here we define a primary version of the template class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_void">is_void</link></computeroutput>, + and provide a full-specialization when <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. While full specialization + of a template class is an important technique, sometimes we need a solution + that is halfway between a fully generic solution, and a full specialization. + This is exactly the situation for which the standards committee defined partial + template-class specialization. As an example, consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>: + here we needed a primary version that handles all the cases where T is not + a pointer, and a partial specialization to handle all the cases where T is + a pointer: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">*></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + The syntax for partial specialization is somewhat arcane and could easily occupy + an article in its own right; like full specialization, in order to write a + partial specialization for a class, you must first declare the primary template. + The partial specialization contains an extra <...> after the class name + that contains the partial specialization parameters; these define the types + that will bind to that partial specialization rather than the default template. + The rules for what can appear in a partial specialization are somewhat convoluted, + but as a rule of thumb if you can legally write two function overloads of the + form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">);</phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">U</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Then you can also write a partial specialization of the form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + This rule is by no means foolproof, but it is reasonably simple to remember + and close enough to the actual rule to be useful for everyday use. + </para> + <para> + As a more complex example of partial specialization consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>. This + class defines a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the same type as T but with any top-level array bounds removed; this + is an example of a traits class that performs a transformation on a type: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">[</phrase><phrase role="identifier">N</phrase><phrase role="special">]></phrase> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + The aim of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + is this: imagine a generic algorithm that is passed an array type as a template + parameter, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + provides a means of determining the underlying type of the array. For example + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">][</phrase><phrase role="number">5</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> would evaluate to the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">5</phrase><phrase role="special">]</phrase></computeroutput>. This example also shows that the number of + template parameters in a partial specialization does not have to match the + number in the default template. However, the number of parameters that appear + after the class name do have to match the number and type of the parameters + in the default template. + </para> + <anchor id="boost_typetraits.background.optimized_copy"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.optimized_copy">Optimized copy</link> + </bridgehead> + <para> + As an example of how the type traits classes can be used, consider the standard + library algorithm copy: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">Iter1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Iter2</phrase><phrase role="special">></phrase> +<phrase role="identifier">Iter2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">Iter1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter2</phrase> <phrase role="identifier">out</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Obviously, there's no problem writing a generic version of copy that works + for all iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput>; however, there are + some circumstances when the copy operation can best be performed by a call + to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. In order to implement + copy in terms of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> all + of the following conditions need to be met: + </para> + <itemizedlist> + <listitem> + Both of the iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must be pointers. + </listitem> + <listitem> + Both <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must point to the same type - excluding + const and volatile-qualifiers. + </listitem> + <listitem> + The type pointed to by <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + must have a trivial assignment operator. + </listitem> + </itemizedlist> + <para> + By trivial assignment operator we mean that the type is either a scalar type<link linkend="background.references">[3]</link> or: + </para> + <itemizedlist> + <listitem> + The type has no user defined assignment operator. + </listitem> + <listitem> + The type does not have any data members that are references. + </listitem> + <listitem> + All base classes, and all data member objects must have trivial assignment + operators. + </listitem> + </itemizedlist> + <para> + If all these conditions are met then a type can be copied using <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> rather than using a compiler generated + assignment operator. The type-traits library provides a class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>, + such that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is true only if T has a trivial assignment + operator. This class "just works" for scalar types, but has to be + explicitly specialised for class/struct types that also happen to have a trivial + assignment operator. In other words if <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + gives the wrong answer, it will give the "safe" wrong answer - that + trivial assignment is not allowable. + </para> + <para> + The code for an optimized version of copy that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + where appropriate is given in <link linkend="boost_typetraits.examples.copy">the + examples</link>. The code begins by defining a template function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">do_copy</phrase></computeroutput> that performs a "slow but safe" + copy. The last parameter passed to this function may be either a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + or a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>. + Following that there is an overload of do<emphasis role="underline">copy that + uses `memcpy`: this time the iterators are required to actually be pointers + to the same type, and the final parameter must be a `</emphasis>_true_type<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">.</phrase> <phrase role="identifier">Finally</phrase><phrase role="special">,</phrase> <phrase role="identifier">the</phrase> <phrase role="identifier">version</phrase> + <phrase role="identifier">of</phrase> </computeroutput>copy<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="identifier">calls</phrase> + </computeroutput>do<emphasis role="underline">copy`, passing `</emphasis>_has_trivial_assign<value_type>()` + as the final parameter: this will dispatch to the optimized version where appropriate, + otherwise it will call the "slow but safe version". + </para> + <anchor id="boost_typetraits.background.was_it_worth_it_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.was_it_worth_it_">Was it worth it?</link> + </bridgehead> + <para> + It has often been repeated in these columns that "premature optimization + is the root of all evil" <link linkend="background.references">[4]</link>. + So the question must be asked: was our optimization premature? To put this + in perspective the timings for our version of copy compared a conventional + generic copy<link linkend="background.references">[5]</link> are shown in table + 1. + </para> + <para> + Clearly the optimization makes a difference in this case; but, to be fair, + the timings are loaded to exclude cache miss effects - without this accurate + comparison between algorithms becomes difficult. However, perhaps we can add + a couple of caveats to the premature optimization rule: + </para> + <itemizedlist> + <listitem> + If you use the right algorithm for the job in the first place then optimization + will not be required; in some cases, memcpy is the right algorithm. + </listitem> + <listitem> + If a component is going to be reused in many places by many people then optimizations + may well be worthwhile where they would not be so for a single case - in + other words, the likelihood that the optimization will be absolutely necessary + somewhere, sometime is that much higher. Just as importantly the perceived + value of the stock implementation will be higher: there is no point standardizing + an algorithm if users reject it on the grounds that there are better, more + heavily optimized versions available. + </listitem> + </itemizedlist> + <table frame="all"> <title>Time taken to copy 1000 elements using `copy<const + T*, T*>` (times in micro-seconds)</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Version + </para> + </entry><entry> + <para> + T + </para> + </entry><entry> + <para> + Time + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 0.99 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 8.07 + </para> + </entry> + </row> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 2.52 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 8.02 + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <anchor id="boost_typetraits.background.pair_of_references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.pair_of_references">Pair of References</link> + </bridgehead> + <para> + The optimized copy example shows how type traits may be used to perform optimization + decisions at compile-time. Another important usage of type traits is to allow + code to compile that otherwise would not do so unless excessive partial specialization + is used. This is possible by delegating partial specialization to the type + traits classes. Our example for this form of usage is a pair that can hold + references <link linkend="background.references">[6]</link>. + </para> + <para> + First, let us examine the definition of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput>, omitting + the comparison operators, default constructor, and template copy constructor + for simplicity: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Now, this "pair" cannot hold references as it currently stands, because + the constructor would require taking a reference to a reference, which is currently + illegal <link linkend="background.references">[7]</link>. Let us consider what + the constructor's parameters would have to be in order to allow "pair" + to hold non-reference types, references, and constant references: + </para> + <table frame="all"> <title>Required Constructor Argument Types</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of parameter to initializing constructor + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + A little familiarity with the type traits classes allows us to construct a + single mapping that allows us to determine the type of parameter from the type + of the contained class. The type traits classes provide a transformation <link linkend="boost_typetraits.reference.add_reference">add_reference</link>, which + adds a reference to its type, unless it is already a reference. + </para> + <table frame="all"> <title>Using add_reference to synthesize the correct constructor + type</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & [8] + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + This allows us to build a primary template definition for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> + that can contain non-reference types, reference types, and constant reference + types: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> + <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Add back in the standard comparison operators, default constructor, and template + copy constructor (which are all the same), and you have a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput> that + can hold reference types! + </para> + <para> + This same extension could have been done using partial template specialization + of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>, but to specialize + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> in this way would require + three partial specializations, plus the primary template. Type traits allows + us to define a single primary template that adjusts itself auto-magically to + any of these partial specializations, instead of a brute-force partial specialization + approach. Using type traits in this fashion allows programmers to delegate + partial specialization to the type traits classes, resulting in code that is + easier to maintain and easier to understand. + </para> + <anchor id="boost_typetraits.background.conclusion"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.conclusion">Conclusion</link> + </bridgehead> + <para> + We hope that in this article we have been able to give you some idea of what + type-traits are all about. A more complete listing of the available classes + are in the boost documentation, along with further examples using type traits. + Templates have enabled C++ uses to take the advantage of the code reuse that + generic programming brings; hopefully this article has shown that generic programming + does not have to sink to the lowest common denominator, and that templates + can be optimal as well as generic. + </para> + <anchor id="boost_typetraits.background.acknowledgements"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.acknowledgements">Acknowledgements</link> + </bridgehead> + <para> + The authors would like to thank Beman Dawes and Howard Hinnant for their helpful + comments when preparing this article. + </para> + <anchor id="background.references"/> <anchor id="boost_typetraits.background.references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.references">References</link> + </bridgehead> + <orderedlist inheritnum="ignore" continuation="restarts"> + <listitem> + Nathan C. Myers, C++ Report, June 1995. + </listitem> + <listitem> + The type traits library is based upon contributions by Steve Cleary, Beman + Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org. + </listitem> + <listitem> + A scalar type is an arithmetic type (i.e. a built-in integer or floating + point type), an enumeration type, a pointer, a pointer to member, or a const- + or volatile-qualified version of one of these types. + </listitem> + <listitem> + This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg + 268. + </listitem> + <listitem> + The test code is available as part of the boost utility library (see algo_opt_examples.cpp), + the code was compiled with gcc 2.95 with all optimisations turned on, tests + were conducted on a 400MHz Pentium II machine running Microsoft Windows 98. + </listitem> + <listitem> + John Maddock and Howard Hinnant have submitted a "compressed_pair" + library to Boost, which uses a technique similar to the one described here + to hold references. Their pair also uses type traits to determine if any + of the types are empty, and will derive instead of contain to conserve space + -- hence the name "compressed". + </listitem> + <listitem> + This is actually an issue with the C++ Core Language Working Group (issue + #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow + a "reference to a reference to T" to mean the same thing as a "reference + to T", but only in template instantiation, in a method similar to multiple + cv-qualifiers. + </listitem> + <listitem> + For those of you who are wondering why this shouldn't be const-qualified, + remember that references are always implicitly constant (for example, you + can't re-assign a reference). Remember also that "const T &" + is something completely different. For this reason, cv-qualifiers on template + type arguments that are references are ignored. + </listitem> + </orderedlist> + </section> + <section id="boost_typetraits.category"> + <title><link linkend="boost_typetraits.category"> Type Traits by Category</link></title> + <section id="boost_typetraits.category.value_traits"> + <title><link linkend="boost_typetraits.category.value_traits"> Type Traits + that Describe the Properties of a Type</link></title> + <para> + <indexterm> + <primary>Foo2</primary> + <secondary>Bar2</secondary> + </indexterm> + These traits are all <emphasis>value traits</emphasis>, which is to say the + traits classes all inherit from <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link>, + and are used to access some numerical property of a type. Often this is a + simple true or false Boolean value, but in a few cases may be some other + integer value (for example when dealing with type alignments, or array bounds: + see <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.alignment_of">alignment_of</link></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.rank">rank</link></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.extent">extent</link></computeroutput>). + </para> + <section id="boost_typetraits.category.value_traits.primary"> + <title><link linkend="boost_typetraits.category.value_traits.primary"> Categorizing + a Type</link></title> + <para> + These traits identify what "kind" of type some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is. These are split into two groups: + primary traits which are all mutually exclusive, and composite traits that + are compositions of one or more primary traits. + </para> + <para> + For any given type, exactly one primary type trait will inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + and all the others will inherit from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + in other words these traits are mutually exclusive. + </para> + <para> + This means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + will only ever be true for built-in types; if you want to check for a user-defined + class type that behaves "as if" it is an integral or floating + point type, then use the <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric_limits</phrase> + <phrase role="keyword">template</phrase></computeroutput> instead. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_array">is_array</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_complex">is_complex</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_enum">is_enum</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">;</phrase> +</programlisting> + <para> + The following traits are made up of the union of one or more type categorizations. + A type may belong to more than one of these categories, in addition to + one of the primary categories. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_arithmetic">is_arithmetic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_compound">is_compound</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_object">is_object</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_scalar">is_scalar</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.properties"> + <title><link linkend="boost_typetraits.category.value_traits.properties"> + General Type Properties</link></title> + <para> + The following templates describe the general properties of a type. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.alignment_of">alignment_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_abstract">is_abstract</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_const">is_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_empty">is_empty</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_signed">is_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_unsigned">is_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_volatile">is_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.extent">extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.relate"> + <title><link linkend="boost_typetraits.category.value_traits.relate"> Relationships + Between Two Types</link></title> + <para> + These templates determine the whether there is a relationship between two + types: + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_base_of">is_base_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.category.transform"> + <title><link linkend="boost_typetraits.category.transform"> Type Traits that + Transform One Type to Another</link></title> + <para> + The following templates transform one type to another, based upon some well-defined + rule. Each template has a single member called <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of applying the transformation to the template argument + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_const">add_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_cv">add_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_pointer">add_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_volatile">add_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.decay">decay</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_signed">make_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_unsigned">make_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.promote">promote</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_all_extents">remove_all_extents</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_const">remove_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_cv">remove_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_reference">remove_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_volatile">remove_volatile</link><phrase role="special">;</phrase> +</programlisting> + <anchor id="boost_typetraits.category.transform.broken_compiler_workarounds_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">Broken + Compiler Workarounds:</link> + </bridgehead> + <para> + For all of these templates support for partial specialization of class templates + is required to correctly implement the transformation. On the other hand, + practice shows that many of the templates from this category are very useful, + and often essential for implementing some generic libraries. Lack of these + templates is often one of the major limiting factors in porting those libraries + to compilers that do not yet support this language feature. As some of these + compilers are going to be around for a while, and at least one of them is + very wide-spread, it was decided that the library should provide workarounds + where possible. + </para> + <para> + The basic idea behind the workaround is to manually define full specializations + of all type transformation templates for all fundamental types, and all their + 1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide + a user-level macro that will define all the explicit specializations needed + for any user-defined type T. + </para> + <para> + The first part guarantees the successful compilation of something like this: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="special">...</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +</programlisting> + <para> + and the second part provides the library's users with a mechanism to make + the above code work not only for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> or other built-in type, + but for their own types as well: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">namespace</phrase> <phrase role="identifier">myspace</phrase><phrase role="special">{</phrase> + <phrase role="keyword">struct</phrase> <phrase role="identifier">MyClass</phrase> <phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +<phrase role="comment">// declare this at global scope: +</phrase><phrase role="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase><phrase role="special">(</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">)</phrase> +<phrase role="comment">// transformations on myspace::MyClass now work: +</phrase><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="comment">// etc. +</phrase></programlisting> + <para> + Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates + to nothing on those compilers that <emphasis role="bold">do</emphasis> support + partial specialization. + </para> + </section> + <section id="boost_typetraits.category.alignment"> + <title><link linkend="boost_typetraits.category.alignment"> Synthesizing Types + with Specific Alignments</link></title> + <para> + Some low level memory management routines need to synthesize a POD type with + specific alignment properties. The template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link></computeroutput> + finds the smallest type with a specified alignment, while template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link></computeroutput> + creates a type with a specific size and alignment. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.function"> + <title><link linkend="boost_typetraits.category.function"> Decomposing Function + Types</link></title> + <para> + The class template <link linkend="boost_typetraits.reference.function_traits">function_traits</link> + extracts information from function types (see also <link linkend="boost_typetraits.reference.is_function">is_function</link>). + This traits class allows you to tell how many arguments a function takes, + what those argument types are, and what the return type is. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.function_traits">function_traits</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.user_defined"> + <title><link linkend="boost_typetraits.user_defined"> User Defined Specializations</link></title> + <para> + Occationally the end user may need to provide their own specialization for + one of the type traits - typically where intrinsic compiler support is required + to implement a specific trait fully. These specializations should derive from + boost::<link linkend="boost_typetraits.reference.integral_constant">true_type</link> + or boost::<link linkend="boost_typetraits.reference.integral_constant">false_type</link> + as appropriate: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> + +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_pod</phrase><phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_union</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">char</phrase> <phrase role="identifier">c</phrase><phrase role="special">;</phrase> + <phrase role="keyword">int</phrase> <phrase role="identifier">i</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">namespace</phrase> <phrase role="identifier">boost</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_pod</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.intrinsics"> + <title><link linkend="boost_typetraits.intrinsics"> Support for Compiler Intrinsics</link></title> + <para> + There are some traits that can not be implemented within the current C++ language: + to make these traits "just work" with user defined types, some kind + of additional help from the compiler is required. Currently (April 2008) Visual + C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other + compilers will no doubt follow in due course. + </para> + <para> + The Following traits classes always need compiler support to do the right thing + for all types (but all have safe fallback positions if this support is unavailable): + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_union">is_union</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_pod">is_pod</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link> + </listitem> + </itemizedlist> + <para> + The following traits classes can't be portably implemented in the C++ language, + although in practice, the implementations do in fact do the right thing on + all the compilers we know about: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_empty">is_empty</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link> + </listitem> + </itemizedlist> + <para> + The following traits classes are dependent on one or more of the above: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_class">is_class</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link> + </listitem> + </itemizedlist> + <para> + The hooks for compiler-intrinsic support are defined in <ulink url="../../../../boost/type_traits/intrinsics.hpp">boost/type_traits/intrinsics.hpp</ulink>, + adding support for new compilers is simply a matter of defining one of more + of the following macros: + </para> + <table frame="all"> <title>Macros for Compiler Intrinsics</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + BOOST_IS_UNION(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a union type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + BOOST_IS_POD(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a POD type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_EMPTY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an empty struct or union + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if the default constructor for T is trivial (i.e. + has no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial copy constructor (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial assignment operator (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial destructor (i.e. ~T() has + no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">x</phrase><phrase role="special">;</phrase></computeroutput> + can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">(</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">t</phrase><phrase role="special">,</phrase> + <phrase role="identifier">u</phrase><phrase role="special">;</phrase> + <phrase role="identifier">t</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">u</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_VIRTUAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true T has a virtual destructor + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ABSTRACT(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an abstract type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_BASE_OF(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a base class of U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CLASS(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a class type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CONVERTIBLE(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is convertible to U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ENUM(T) + </para> + </entry><entry> + <para> + Should evaluate to true is T is an enum + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_POLYMORPHIC(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a polymorphic type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_ALIGNMENT_OF(T) + </para> + </entry><entry> + <para> + Should evaluate to the alignment requirements of type T. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.mpl"> + <title><link linkend="boost_typetraits.mpl"> MPL Interoperability</link></title> + <para> + All the value based traits in this library conform to MPL's requirements for + an <ulink url="../../../../libs/mpl/doc/refmanual/integral-constant.html">Integral + Constant type</ulink>: that includes a number of rather intrusive workarounds + for broken compilers. + </para> + <para> + Purely as an implementation detail, this means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">true_</phrase></computeroutput></ulink>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">false_</phrase></computeroutput></ulink>, + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> + <phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/integral-c.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">integral_c</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput></ulink> + (provided <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>) + </para> + </section> + <section id="boost_typetraits.examples"> + <title><link linkend="boost_typetraits.examples"> Examples</link></title> + <section id="boost_typetraits.examples.copy"> + <title><link linkend="boost_typetraits.examples.copy"> An Optimized Version + of std::copy</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">copy</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + to optimise the copy operation (see <ulink url="../../examples/copy_example.cpp">copy_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// opt::copy +</phrase><phrase role="comment">// same semantics as std::copy +</phrase><phrase role="comment">// calls memcpy where appropriate. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="identifier">I2</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">out</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">out</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">memcpy</phrase><phrase role="special">(</phrase><phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="special">(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">)*</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">));</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">+(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can copy with memcpy if T has a trivial assignment operator, +</phrase> <phrase role="comment">// and if the iterator arguments are actually pointers (this last +</phrase> <phrase role="comment">// requirement we detect with overload resolution): +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">value_type</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.fill"> + <title><link linkend="boost_typetraits.examples.fill"> An Optimised Version + of std::fill</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">fill</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memset</phrase></computeroutput> + to optimise the fill operation (see <ulink url="../../examples/fill_example.cpp">fill_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// fill +</phrase><phrase role="comment">// same as std::fill, but uses memset where appropriate +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">first</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">memset</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can do an optimised fill if T has a trivial assignment +</phrase> <phrase role="comment">// operator and if it's size is one: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> <phrase role="special">&&</phrase> <phrase role="special">(</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase> <phrase role="special">==</phrase> <phrase role="number">1</phrase><phrase role="special">)></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.destruct"> + <title><link linkend="boost_typetraits.examples.destruct"> An Example that + Omits Destructor Calls For Types with Trivial Destructors</link></title> + <para> + Demonstrates a simple algorithm that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">__has_trivial_destruct</phrase></computeroutput> + to determine whether to destructors need to be called (see <ulink url="../../examples/trivial_destructor_example.cpp">trivial_destructor_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// algorithm destroy_array: +</phrase><phrase role="comment">// The reverse of std::unitialized_copy, takes a block of +</phrase><phrase role="comment">// initialized memory and calls destructors on all objects therein. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="identifier">first</phrase><phrase role="special">->~</phrase><phrase role="identifier">T</phrase><phrase role="special">();</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> <phrase role="comment">// namespace detail +</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p2</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">p2</phrase><phrase role="special">,</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.iter"> + <title><link linkend="boost_typetraits.examples.iter"> An improved Version + of std::iter_swap</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + that use type traits to determine whether an it's arguments are proxying + iterators or not, if they're not then it just does a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase></computeroutput> + of it's dereferenced arguments (the same as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + does), however if they are proxying iterators then takes special care over + the swap to ensure that the algorithm works correctly for both proxying iterators, + and even iterators of different types (see <ulink url="../../examples/iter_swap_example.cpp">iter_swap_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// iter_swap: +</phrase><phrase role="comment">// tests whether iterator is a proxying iterator or not, and +</phrase><phrase role="comment">// uses optimal form accordingly: +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">v_t</phrase><phrase role="special">;</phrase> + <phrase role="identifier">v_t</phrase> <phrase role="identifier">v</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">one</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">one</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">two</phrase> <phrase role="special">=</phrase> <phrase role="identifier">v</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">using</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase><phrase role="special">;</phrase> + <phrase role="identifier">swap</phrase><phrase role="special">(*</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">iter_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">two</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// See is both arguments are non-proxying iterators, +</phrase> <phrase role="comment">// and if both iterator the same type: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r1_t</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I2</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">;</phrase> + + <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.to_double"> + <title><link linkend="boost_typetraits.examples.to_double"> Convert Numeric + Types and Enums to double</link></title> + <para> + Demonstrates a conversion of <ulink url="../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric + Types</ulink> and enum types to double: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">double</phrase> <phrase role="identifier">to_double</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">value</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">promoted</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric</phrase><phrase role="special">::</phrase><phrase role="identifier">converter</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase><phrase role="identifier">promoted</phrase><phrase role="special">>::</phrase><phrase role="identifier">convert</phrase><phrase role="special">(</phrase><phrase role="identifier">value</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.reference"> + <title><link linkend="boost_typetraits.reference"> Alphabetical Reference</link></title> + <section id="boost_typetraits.reference.add_const"> + <title><link linkend="boost_typetraits.reference.add_const"> add_const</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_cv"> + <title><link linkend="boost_typetraits.reference.add_cv"> add_cv</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + <tertiary>three</tertiary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_pointer"> + <title><link linkend="boost_typetraits.reference.add_pointer"> add_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + <para> + The rationale for this template is that it produces the same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">TYPEOF</phrase><phrase role="special">(&</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput>, where + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">t</phrase></computeroutput> is an object of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_reference"> + <title><link linkend="boost_typetraits.reference.add_reference"> add_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is not a reference type then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">&</phrase></computeroutput>, otherwise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_volatile"> + <title><link linkend="boost_typetraits.reference.add_volatile"> add_volatile</link></title> + <indexterm type="class_name"> + <primary>one</primary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.aligned_storage"> + <title><link linkend="boost_typetraits.reference.aligned_storage"> aligned_storage</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">aligned_storage</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with size + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Size</phrase></computeroutput> and an alignment that + is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">aligned_storage</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.alignment_of"> + <title><link linkend="boost_typetraits.reference.alignment_of"> alignment_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">alignment_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template alignment<emphasis role="underline">of inherits from `</emphasis>_integral_constant<std::size_t, + ALIGNOF(T)><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">,</phrase> <phrase role="identifier">where</phrase> + </computeroutput>ALIGNOF(T)` is the alignment of type T. + </para> + <para> + <emphasis>Note: strictly speaking you should only rely on the value of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> being + a multiple of the true alignment of T, although in practice it does compute + the correct value in all the cases we know about.</emphasis> + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">alignment_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">char</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + with value <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.decay"> + <title><link linkend="boost_typetraits.reference.decay"> decay</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">decay</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> Let <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + be the result of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput>, then if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + is an array type, the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>*</phrase></computeroutput>, + otherwise if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> is a function + type then the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase><phrase role="special">*</phrase></computeroutput>, otherwise the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">decay</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.extent"> + <title><link linkend="boost_typetraits.reference.extent"> extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">extent</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template extent inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is the number of elements in the N'th array + dimention of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">N</phrase> <phrase role="special">></phrase> + <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput>, or if the N'th array bound is incomplete, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">],</phrase> + <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>4</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">],</phrase> <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.floating_point_promotion"> + <title><link linkend="boost_typetraits.reference.floating_point_promotion"> + floating_point_promotion</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">floating_point_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If floating point promotion can be + applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies floating point promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">float</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.function_traits"> + <title><link linkend="boost_typetraits.reference.function_traits"> function_traits</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">F</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">function_traits</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">arity</phrase> <phrase role="special">=</phrase> <replaceable>see-below</replaceable><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">result_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> arg<replaceable>N</replaceable>_type<phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + The class template function_traits will only compile if: + </para> + <itemizedlist> + <listitem> + The compiler supports partial specialization of class templates. + </listitem> + <listitem> + The template argument <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput> + is a <emphasis>function type</emphasis>, note that this <emphasis><emphasis role="bold">is not</emphasis></emphasis> the same thing as a <emphasis>pointer + to a function</emphasis>. + </listitem> + </itemizedlist> + <tip> + <para> + function_traits is intended to introspect only C++ functions of the form + R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member + functions. To convert a function pointer type to a suitable type use <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link>. + </para> + </tip> + <table frame="all"> <title>Function Traits Members</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Member + </para> + </entry><entry> + <para> + Description + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that gives the number of arguments + accepted by the function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type returned by function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase>arg<replaceable>N</replaceable>_type</computeroutput> + </para> + </entry><entry> + <para> + The <replaceable>N</replaceable>th argument type of function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="number">1</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">N</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">arity</phrase></computeroutput> of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 0. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 1. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 4. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">long</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arg1_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg4_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg5_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: there is no <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">arg5_type</phrase></computeroutput> + since there are only four arguments. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: argument type is a <emphasis>function pointer</emphasis>, + and not a <emphasis>function type</emphasis>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.has_nothrow_assign"> + <title><link linkend="boost_typetraits.reference.has_nothrow_assign"> has_nothrow_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_assign</phrase></computeroutput> + will never report that a class or struct has a non-throwing assignment-operator; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler support to ensure that this trait "just + works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_constructor"> + <title><link linkend="boost_typetraits.reference.has_nothrow_constructor"> + has_nothrow_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_constructor</phrase></computeroutput> + will never report that a class or struct has a non-throwing default-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_copy"> + <title><link linkend="boost_typetraits.reference.has_nothrow_copy"> has_nothrow_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_copy</phrase></computeroutput> + will never report that a class or struct has a non-throwing copy-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_nothrow_cp_cons"> has_nothrow_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_no_throw_def_cons"> + <title><link linkend="boost_typetraits.reference.has_no_throw_def_cons"> has_nothrow_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_assign"> + <title><link linkend="boost_typetraits.reference.has_trivial_assign"> has_trivial_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial assignment-operator then the operator has the same + effect as copying the bits of one object to the other: calls to the operator + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_assign + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p11. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_constructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_constructor"> + has_trivial_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial default-constructor then the constructor have no + effect: calls to the constructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_constructor + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.1p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_copy"> + <title><link linkend="boost_typetraits.reference.has_trivial_copy"> has_trivial_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial copy-constructor then the constructor has the same + effect as copying the bits of one object to the other: calls to the constructor + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_copy + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_cp_cons"> has_trivial_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_def_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_def_cons"> has_trivial_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_destructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_destructor"> has_trivial_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial destructor then the destructor has no effect: calls + to the destructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_destructor + will never report that a user-defined class or struct has a trivial destructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4p3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_virtual_destructor"> + <title><link linkend="boost_typetraits.reference.has_virtual_destructor"> has_virtual_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_virtual_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a virtual destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This trait is provided + for completeness, since it's part of the Technical Report on C++ Library + Extensions. However, there is currently no way to portably implement this + trait. The default version provided always inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + and has to be explicitly specialized for types with virtual destructors unless + the compiler used has compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + that enable the trait to do the right thing: currently (May 2005) only Visual + C++ 8 and GCC-4.3 have the necessary <link linkend="boost_typetraits.intrinsics">intrinsics</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_virtual_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.integral_constant"> + <title><link linkend="boost_typetraits.reference.integral_constant"> integral_constant</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_constant</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">true</phrase><phrase role="special">></phrase> <phrase role="identifier">true_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">false</phrase><phrase role="special">></phrase> <phrase role="identifier">false_type</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + Class template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_constant</phrase></computeroutput> + is the common base class for all the value-based type traits. The two typedef's + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">true_type</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">false_type</phrase></computeroutput> are provided for convenience: + most of the value traits are Boolean properties and so will inherit from + one of these. + </para> + </section> + <section id="boost_typetraits.reference.integral_promotion"> + <title><link linkend="boost_typetraits.reference.integral_promotion"> integral_promotion</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral promotion can be applied + to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, then + applies integral promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field). + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">integral_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">enum</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">float_round_style</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.is_abstract"> + <title><link linkend="boost_typetraits.reference.is_abstract"> is_abstract</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_abstract</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + abstract type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_abstract</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The compiler must + support DR337 (as of April 2005: GCC 3.4, VC++ 7.1 (and later), Intel C++ + 7 (and later), and Comeau 4.3.2). Otherwise behaves the same as <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>; + this is the "safe fallback position" for which polymorphic types + are always regarded as potentially abstract. The macro BOOST_NO_IS_ABSTRACT + is used to signify that the implementation is buggy, users should check for + this in their own code if the "safe fallback" is not suitable for + their particular use-case. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">abc</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">abc</phrase><phrase role="special">()</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_arithmetic"> + <title><link linkend="boost_typetraits.reference.is_arithmetic"> is_arithmetic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_arithmetic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + arithmetic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Arithmetic types include integral and floating point types (see also <link linkend="boost_typetraits.reference.is_integral">is_integral</link> and + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_arithmetic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_array"> + <title><link linkend="boost_typetraits.reference.is_array"> is_array</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_array</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + array type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_array</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can give the wrong result with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_base_of"> + <title><link linkend="boost_typetraits.reference.is_base_of"> is_base_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_base_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If Base is base class of type + Derived or if both types are the same then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + This template will detect non-public base classes, and ambiguous base classes. + </para> + <para> + Note that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">X</phrase><phrase role="special">,</phrase><phrase role="identifier">X</phrase><phrase role="special">></phrase></computeroutput> will always inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>. + <emphasis role="bold">This is the case even if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">X</phrase></computeroutput> + is not a class type</emphasis>. This is a change in behaviour from Boost-1.33 + in order to track the Technical Report on C++ Library Extensions. + </para> + <para> + Types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput> must not be incomplete types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_base_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. There are some older compilers which + will produce compiler errors if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> + is a private base class of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> is an ambiguous + base of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>. These compilers + include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and + older versions of EDG based compilers. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase> <phrase role="special">:</phrase> + <phrase role="keyword">public</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Base</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>: a class is regarded as it's + own base. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_class"> + <title><link linkend="boost_typetraits.reference.is_class"> is_class</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_class</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + class type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types, as a result this type will erroneously inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> for + union types. See also <link linkend="boost_typetraits.reference.is_union">is_union</link>. + Currently (May 2005) only Visual C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to correctly identify union types, and therefore make is_class function correctly. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">MyClass</phrase><phrase role="special">;</phrase></computeroutput> then: + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_complex"> + <title><link linkend="boost_typetraits.reference.is_complex"> is_complex</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_complex</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is a complex number type then true (of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">complex</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">></phrase></computeroutput> + for some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>), otherwise + false. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 26.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_complex</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.is_compound"> + <title><link linkend="boost_typetraits.reference.is_compound"> is_compound</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_compound</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + compound type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Any type that is not a fundamental type is a compound type (see also <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_compound</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyEnum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_const"> + <title><link linkend="boost_typetraits.reference.is_const"> is_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_const</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) const-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_convertible"> + <title><link linkend="boost_typetraits.reference.is_convertible"> is_convertible</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_convertible</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If an imaginary lvalue of type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> is convertible to type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type From must not be an incomplete type. + </para> + <para> + Type To must not be an incomplete, or function type. + </para> + <para> + No types are considered to be convertible to array types or abstract-class + types. + </para> + <para> + This template can not detect whether a converting-constructor is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> or not: if type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">private</phrase></computeroutput> converting constructor + from type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> then instantiating + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase></computeroutput> + will produce a compiler error. For this reason <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase></computeroutput> + can not be used to determine whether a type has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> + copy-constructor or not. + </para> + <para> + This template will also produce compiler errors if the conversion is ambiguous, + for example: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">B</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">C</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">D</phrase> <phrase role="special">:</phrase> <phrase role="identifier">B</phrase><phrase role="special">,</phrase> <phrase role="identifier">C</phrase> <phrase role="special">{};</phrase> +<phrase role="comment">// This produces a compiler error, the conversion is ambiguous: +</phrase><phrase role="keyword">bool</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">D</phrase><phrase role="special">*,</phrase><phrase role="identifier">A</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4 and 8.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This template is + currently broken with Borland C++ Builder 5 (and earlier), for constructor-based + conversions, and for the Metrowerks 7 (and earlier) compiler in all cases. + If the compiler does not support <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_abstract">is_abstract</link></computeroutput>, + then the template parameter <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + must not be an abstract type. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the conversion would require a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const_cast</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&,</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_empty"> + <title><link linkend="boost_typetraits.reference.is_empty"> is_empty</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_empty</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an empty class type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10p5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> In order to correctly + detect empty classes this trait relies on either: + </para> + <itemizedlist> + <listitem> + the compiler implementing zero sized empty base classes, or + </listitem> + <listitem> + the compiler providing <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect empty classes. + </listitem> + </itemizedlist> + <para> + Can not be used with incomplete types. + </para> + <para> + Can not be used with union types, until is_union can be made to work. + </para> + <para> + If the compiler does not support partial-specialization of class templates, + then this template can not be used with abstract types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">empty_class</phrase> + <phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_enum"> + <title><link linkend="boost_typetraits.reference.is_enum"> is_enum</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_enum</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + enum type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_enum</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Requires a correctly + functioning <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template; this means that is_enum is currently broken under Borland C++ Builder + 5, and for the Metrowerks compiler prior to version 8, other compilers should + handle this template just fine. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">enum</phrase> <phrase role="identifier">my_enum</phrase> + <phrase role="special">{</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_floating_point"> + <title><link linkend="boost_typetraits.reference.is_floating_point"> is_floating_point</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_floating_point</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + floating point type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_floating_point</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_function"> + <title><link linkend="boost_typetraits.reference.is_function"> is_function</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_function</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + function type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Note that this template does not detect <emphasis>pointers to functions</emphasis>, + or <emphasis>references to functions</emphasis>, these are detected by <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> and <link linkend="boost_typetraits.reference.is_reference">is_reference</link> respectively: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="identifier">f1</phrase><phrase role="special">();</phrase> <phrase role="comment">// f1 is of function type. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f2</phrase><phrase role="special">*)();</phrase> <phrase role="comment">// f2 is a pointer to a function. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f3</phrase><phrase role="special">&)();</phrase> <phrase role="comment">// f3 is a reference to a function. +</phrase></programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p1 and 8.3.5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_function</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer type, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a reference to a function, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer to a member function. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <tip> + <para> + Don't confuse function-types with pointers to functions: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> + <phrase role="identifier">f</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">);</phrase></computeroutput> + </para> + <para> + defines a function type, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase> <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a prototype for a function of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase></computeroutput>, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">*</phrase> + <phrase role="identifier">pf</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">&</phrase> + <phrase role="identifier">fr</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a pointer and a reference to the function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">foo</phrase></computeroutput>. + </para> + <para> + If you want to detect whether some type is a pointer-to-function then use: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special"><</phrase><link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + </para> + <para> + or for pointers to member functions you can just use <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + directly. + </para> + </tip> + </section> + <section id="boost_typetraits.reference.is_fundamental"> + <title><link linkend="boost_typetraits.reference.is_fundamental"> is_fundamental</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_fundamental</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + fundamental type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Fundamental types include integral, floating point and void types (see also + <link linkend="boost_typetraits.reference.is_integral">is_integral</link>, + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link> + and <link linkend="boost_typetraits.reference.is_void">is_void</link>) + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_fundamental</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_integral"> + <title><link linkend="boost_typetraits.reference.is_integral"> is_integral</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_integral</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + integral type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p7. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_integral</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_function_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_function_pointer"> + is_member_function_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_function_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member function then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a data member and not a member + function, see <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_object_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_object_pointer"> + is_member_object_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_object_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member object (a data member) then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a member function and not a + member object, see <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_pointer"> is_member_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member (either a function or a data member) then inherits from + <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_object"> + <title><link linkend="boost_typetraits.reference.is_object"> is_object</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_object</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + object type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + All types are object types except references, void, and function types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_object</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: reference types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: function types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + void is not an object type + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pod"> + <title><link linkend="boost_typetraits.reference.is_pod"> is_pod</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pod</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + POD type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + POD stands for "Plain old data". Arithmetic types, and enumeration + types, a pointers and pointer to members are all PODs. Classes and unions + can also be POD's if they have no non-static data members that are of reference + or non-POD type, no user defined constructors, no user defined assignment + operators, no private or protected non-static data members, no virtual functions + and no base classes. Finally, a cv-qualified POD is still a POD, as is an + array of PODs. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10 and 9p4 (Note + that POD's are also aggregates, see 8.5.1). + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is<emphasis role="underline">pod + will never report that a class or struct is a POD; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler-</emphasis>_intrinsics. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pointer"> + <title><link linkend="boost_typetraits.reference.is_pointer"> is_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer type (includes function pointers, but excludes pointers to members) + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p2 and 8.3.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <important> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> detects "real" + pointer types only, and <emphasis>not</emphasis> smart pointers. Users + should not specialise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> + for smart pointer types, as doing so may cause Boost (and other third party) + code to fail to function correctly. Users wanting a trait to detect smart + pointers should create their own. However, note that there is no way in + general to auto-magically detect smart pointer types, so such a trait would + have to be partially specialised for each supported smart pointer type. + </para> + </important> + </section> + <section id="boost_typetraits.reference.is_polymorphic"> + <title><link linkend="boost_typetraits.reference.is_polymorphic"> is_polymorphic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_polymorphic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + polymorphic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The implementation + requires some knowledge of the compilers ABI, it does actually seem to work + with the majority of compilers though. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_polymorphic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">poly</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">poly</phrase><phrase role="special">();</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_same"> + <title><link linkend="boost_typetraits.reference.is_same"> is_same</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_same</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T and U are the same types + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_same</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with abstract, incomplete or function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_scalar"> + <title><link linkend="boost_typetraits.reference.is_scalar"> is_scalar</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_scalar</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + scalar type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Scalar types include integral, floating point, enumeration, pointer, and + pointer-to-member types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_scalar</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_signed"> + <title><link linkend="boost_typetraits.reference.is_signed"> is_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_signed</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an signed integer type + or an enumerated type with an underlying signed integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_stateless"> + <title><link linkend="boost_typetraits.reference.is_stateless"> is_stateless</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_stateless</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Ff T is a stateless type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type T must be a complete type. + </para> + <para> + A stateless type is a type that has no storage and whose constructors and + destructors are trivial. That means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_stateless</phrase></computeroutput> + only inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the following expression is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">true</phrase></computeroutput>: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_stateless</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is_stateless will + never report that a class or struct is stateless; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this template work automatically. + </para> + </section> + <section id="boost_typetraits.reference.is_reference"> + <title><link linkend="boost_typetraits.reference.is_reference"> is_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_reference</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a reference pointer type + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + may report the wrong result for function types, and for types that are both + const and volatile qualified. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis> (the argument in this case + is a reference to a function). + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_union"> + <title><link linkend="boost_typetraits.reference.is_union"> is_union</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_union</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + union type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Currently requires some kind of compiler support, otherwise unions are identified + as classes. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types using only standard C++, as a result this type will never + inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + unless the user explicitly specializes the template for their user-defined + union types, or unless the compiler supplies some unspecified intrinsic that + implements this functionality. Currently (May 2005) only Visual C++ 8 has + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this trait "just work" without user intervention. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_unsigned"> + <title><link linkend="boost_typetraits.reference.is_unsigned"> is_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_unsigned</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an unsigned integer type + or an enumerated type with an underlying unsigned integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_void"> + <title><link linkend="boost_typetraits.reference.is_void"> is_void</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_void</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + void type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_void</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_volatile"> + <title><link linkend="boost_typetraits.reference.is_volatile"> is_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_volatile</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) volatile-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">volatile</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase> + <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the volatile qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.make_signed"> + <title><link linkend="boost_typetraits.reference.make_signed"> make_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_signed</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a signed integer type then + the same type as T, if T is an unsigned integer type then the corresponding + signed type. Otherwise if T is an enumerated or character type (char or wchar_t) + then a signed integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.make_unsigned"> + <title><link linkend="boost_typetraits.reference.make_unsigned"> make_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_unsigned</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a unsigned integer type then + the same type as T, if T is an signed integer type then the corresponding + unsigned type. Otherwise if T is an enumerated or character type (char or + wchar_t) then an unsigned integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.promote"> + <title><link linkend="boost_typetraits.reference.promote"> promote</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">promote</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral or floating point promotion + can be applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies integral and floating point promotions to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + See also <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link> + and <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field) and 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">promote</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.rank"> + <title><link linkend="boost_typetraits.reference.rank"> rank</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">rank</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template rank inherits from + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is the + number of array dimensions in type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">rank</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[]></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>1</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.remove_all_extents"> + <title><link linkend="boost_typetraits.reference.remove_all_extents"> remove_all_extents</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_all_extents</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes all of the array bounds on <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_all_extents</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_const"> + <title><link linkend="boost_typetraits.reference.remove_const"> remove_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> const-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_cv"> + <title><link linkend="boost_typetraits.reference.remove_cv"> remove_cv</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> cv-qualifiers removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_extent"> + <title><link linkend="boost_typetraits.reference.remove_extent"> remove_extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_extent</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes the topmost array bound, otherwise leaves + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_pointer"> + <title><link linkend="boost_typetraits.reference.remove_pointer"> remove_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any pointer modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">**>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_reference"> + <title><link linkend="boost_typetraits.reference.remove_reference"> remove_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any reference modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_volatile"> + <title><link linkend="boost_typetraits.reference.remove_volatile"> remove_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> volatile-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.type_with_alignment"> + <title><link linkend="boost_typetraits.reference.type_with_alignment"> type_with_alignment</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">type_with_alignment</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with an alignment + that is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">type_with_alignment</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + </section> + <section id="boost_typetraits.credits"> + <title><link linkend="boost_typetraits.credits"> Credits</link></title> + <para> + This documentation was pulled together by John Maddock, using <ulink url="../../../../doc/html/quickbook.html">Boost.Quickbook</ulink> + and <ulink url="../../../../doc/html/boostbook.html">Boost.DocBook</ulink>. + </para> + <para> + The original version of this library was created by Steve Cleary, Beman Dawes, + Howard Hinnant, and John Maddock. John Maddock is the current maintainer of + the library. + </para> + <para> + This version of type traits library is based on contributions by Adobe Systems + Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, + Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert + Ramey and Jeremy Siek. + </para> + <para> + Mat Marcus and Jesse Jones invented, and <ulink url="http://opensource.adobe.com/project4/project.shtml">published + a paper describing</ulink>, the partial specialization workarounds used in + this library. + </para> + <para> + Aleksey Gurtovoy added MPL integration to the library. + </para> + <para> + The <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template is based on code originally devised by Andrei Alexandrescu, see "<ulink url="http://www.cuj.com/experts/1810/alexandr.htm?topic=experts">Generic<Programming>: + Mappings between Types and Values</ulink>". + </para> + <para> + The latest version of this library and documentation can be found at <ulink url="http://www.boost.org">www.boost.org</ulink>. Bugs, suggestions and discussion + should be directed to boost@lists.boost.org (see <ulink url="http://www.boost.org/more/mailing_lists.htm#main">www.boost.org/more/mailing_lists.htm#main</ulink> + for subscription details). + </para> + </section> + + <section id="boost_typetraits.ignored_section"> + <title>This section must not be indexed.</title> + <?BoostAutoIndex IgnoreSection?> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + <section id="boost_typetraits.ignored_block"> + <title>This section contains one block that must not be indexed and one that should be.</title> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + <?BoostAutoIndex IgnoreBlock?> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + + <index> + <title>Class Index</title> + <para><link linkend="idx_id_0">A</link> <link linkend="idx_id_2">C</link> <link linkend="idx_id_3">D</link> <link linkend="idx_id_4">E</link> <link linkend="idx_id_5">F</link> <link linkend="idx_id_6">H</link> <link linkend="idx_id_7">I</link> <link linkend="idx_id_8">M</link> <link linkend="idx_id_9">O</link> <link linkend="idx_id_10">P</link> <link linkend="idx_id_11">R</link> <link linkend="idx_id_13">T</link></para><variablelist><varlistentry id="idx_id_0"><term>A</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-0">add_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-0">add_cv</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_pointer"><phrase role="index-entry-level-0">add_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_reference"><phrase role="index-entry-level-0">add_reference</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">add_volatile</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">This section contains one block that must not be indexed and one that should be.</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.aligned_storage"><phrase role="index-entry-level-0">aligned_storage</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-0">alignment_of</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_2"><term>C</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Constrained Index Term</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_3"><term>D</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.decay"><phrase role="index-entry-level-0">decay</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_4"><term>E</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-0">extent</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_5"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.floating_point_promotion"><phrase role="index-entry-level-0">floating_point_promotion</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-0">function_traits</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_6"><term>H</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_assign"><phrase role="index-entry-level-0">has_nothrow_assign</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-0">has_nothrow_constructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-0">has_nothrow_copy</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_assign"><phrase role="index-entry-level-0">has_trivial_assign</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-0">has_trivial_constructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-0">has_trivial_copy</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_destructor"><phrase role="index-entry-level-0">has_trivial_destructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_virtual_destructor"><phrase role="index-entry-level-0">has_virtual_destructor</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_7"><term>I</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">integral_constant</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_promotion"><phrase role="index-entry-level-0">integral_promotion</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_abstract"><phrase role="index-entry-level-0">is_abstract</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_arithmetic"><phrase role="index-entry-level-0">is_arithmetic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_array"><phrase role="index-entry-level-0">is_array</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_base_of"><phrase role="index-entry-level-0">is_base_of</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_class</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_class"><phrase role="index-entry-level-1">is_class</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_complex"><phrase role="index-entry-level-0">is_complex</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_compound"><phrase role="index-entry-level-0">is_compound</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_const"><phrase role="index-entry-level-0">is_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_convertible"><phrase role="index-entry-level-0">is_convertible</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_empty"><phrase role="index-entry-level-0">is_empty</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_enum"><phrase role="index-entry-level-0">is_enum</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_floating_point"><phrase role="index-entry-level-0">is_floating_point</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-0">is_function</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_fundamental"><phrase role="index-entry-level-0">is_fundamental</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_integral"><phrase role="index-entry-level-0">is_integral</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_function_pointer"><phrase role="index-entry-level-0">is_member_function_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_object_pointer"><phrase role="index-entry-level-0">is_member_object_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_pointer"><phrase role="index-entry-level-0">is_member_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_object"><phrase role="index-entry-level-0">is_object</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_pod</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pod"><phrase role="index-entry-level-1">is_pod</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">is_pointer</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pointer"><phrase role="index-entry-level-1">is_pointer</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_polymorphic"><phrase role="index-entry-level-0">is_polymorphic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_reference"><phrase role="index-entry-level-0">is_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_same"><phrase role="index-entry-level-0">is_same</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_scalar"><phrase role="index-entry-level-0">is_scalar</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_signed"><phrase role="index-entry-level-0">is_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_stateless"><phrase role="index-entry-level-0">is_stateless</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_union</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_union"><phrase role="index-entry-level-1">is_union</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_unsigned"><phrase role="index-entry-level-0">is_unsigned</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_void</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_void"><phrase role="index-entry-level-1">is_void</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_volatile"><phrase role="index-entry-level-0">is_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_8"><term>M</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.make_signed"><phrase role="index-entry-level-0">make_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.make_unsigned"><phrase role="index-entry-level-0">make_unsigned</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_9"><term>O</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">one</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-1">two</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-2">add_const</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-2">three</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-3">add_cv</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_10"><term>P</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.promote"><phrase role="index-entry-level-0">promote</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_11"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-0">rank</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_all_extents"><phrase role="index-entry-level-0">remove_all_extents</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_const"><phrase role="index-entry-level-0">remove_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_cv"><phrase role="index-entry-level-0">remove_cv</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">remove_extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.remove_extent"><phrase role="index-entry-level-1">remove_extent</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_pointer"><phrase role="index-entry-level-0">remove_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_reference"><phrase role="index-entry-level-0">remove_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_volatile"><phrase role="index-entry-level-0">remove_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_13"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.type_with_alignment"><phrase role="index-entry-level-0">type_with_alignment</phrase></link></para></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + <index> + <title>Typedef Index</title> + <para><link linkend="idx_id_20">F</link> <link linkend="idx_id_26">R</link> <link linkend="idx_id_28">T</link></para><variablelist><varlistentry id="idx_id_20"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">false_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_26"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">result_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_28"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">true_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + <index> + <title>Macro Index</title> + <para><link linkend="idx_id_31">B</link></para><variablelist><varlistentry id="idx_id_31"><term>B</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">BOOST_ALIGNMENT_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">Type Traits that Transform One Type to Another</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ABSTRACT</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_BASE_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CLASS</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CONVERTIBLE</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_EMPTY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ENUM</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POD</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POLYMORPHIC</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_UNION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + <index> + <title>Index Test 1</title> + <para><link linkend="idx_id_58">T</link></para><variablelist><varlistentry id="idx_id_58"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">Introduction</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + <index> + <title>Index Test 2</title> + <para><link linkend="idx_id_73">T</link></para><variablelist><varlistentry id="idx_id_73"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + <index><title>Index</title><para><link linkend="idx_id_75">A</link> <link linkend="idx_id_76">B</link> <link linkend="idx_id_77">C</link> <link linkend="idx_id_78">D</link> <link linkend="idx_id_79">E</link> <link linkend="idx_id_80">F</link> <link linkend="idx_id_81">H</link> <link linkend="idx_id_82">I</link> <link linkend="idx_id_83">M</link> <link linkend="idx_id_84">O</link> <link linkend="idx_id_85">P</link> <link linkend="idx_id_86">R</link> <link linkend="idx_id_87">S</link> <link linkend="idx_id_88">T</link> <link linkend="idx_id_89">U</link></para><variablelist><varlistentry id="idx_id_75"><term>A</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">add_const</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">Constrained Index Term</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-0">add_cv</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_pointer"><phrase role="index-entry-level-0">add_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.add_reference"><phrase role="index-entry-level-0">add_reference</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">add_volatile</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">This section contains one block that must not be indexed and one that should be.</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.aligned_storage"><phrase role="index-entry-level-0">aligned_storage</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">alignment_of</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_76"><term>B</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Background and Tutorial</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">is_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">is_void</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">remove_extent</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">type-traits</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_ALIGNMENT_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">Type Traits that Transform One Type to Another</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_NOTHROW_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_ASSIGN</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_COPY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ABSTRACT</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_BASE_OF</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CLASS</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_CONVERTIBLE</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_EMPTY</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_ENUM</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POD</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_POLYMORPHIC</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">BOOST_IS_UNION</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">Support for Compiler Intrinsics</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_77"><term>C</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Constrained Index Term</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-1">add_const</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_78"><term>D</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.decay"><phrase role="index-entry-level-0">decay</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_79"><term>E</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_80"><term>F</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">false_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.floating_point_promotion"><phrase role="index-entry-level-0">floating_point_promotion</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">Foo1</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">Foo2</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-1">Bar2</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.value_traits"><phrase role="index-entry-level-2">Type Traits that Describe the Properties of a Type</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">function_traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">result_type</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_81"><term>H</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_assign"><phrase role="index-entry-level-0">has_nothrow_assign</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_default_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_copy"><phrase role="index-entry-level-1">has_nothrow_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_nothrow_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_nothrow_constructor"><phrase role="index-entry-level-1">has_nothrow_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_assign"><phrase role="index-entry-level-0">has_trivial_assign</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_default_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_copy_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_copy"><phrase role="index-entry-level-1">has_trivial_copy</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">has_trivial_default_constructor</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.has_trivial_constructor"><phrase role="index-entry-level-1">has_trivial_constructor</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.has_trivial_destructor"><phrase role="index-entry-level-0">has_trivial_destructor</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.has_virtual_destructor"><phrase role="index-entry-level-0">has_virtual_destructor</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_82"><term>I</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">int</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">is_function</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">integral_constant</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.alignment_of"><phrase role="index-entry-level-1">alignment_of</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.extent"><phrase role="index-entry-level-1">extent</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">false_type</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">true_type</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.integral_promotion"><phrase role="index-entry-level-0">integral_promotion</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">Introduction</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">type-traits</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_abstract"><phrase role="index-entry-level-0">is_abstract</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_arithmetic"><phrase role="index-entry-level-0">is_arithmetic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_array"><phrase role="index-entry-level-0">is_array</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_base_of"><phrase role="index-entry-level-0">is_base_of</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_class</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_class"><phrase role="index-entry-level-1">is_class</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_complex"><phrase role="index-entry-level-0">is_complex</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_compound"><phrase role="index-entry-level-0">is_compound</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_const"><phrase role="index-entry-level-0">is_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_convertible"><phrase role="index-entry-level-0">is_convertible</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_empty"><phrase role="index-entry-level-0">is_empty</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_enum"><phrase role="index-entry-level-0">is_enum</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_floating_point"><phrase role="index-entry-level-0">is_floating_point</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_function</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">int</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_function"><phrase role="index-entry-level-1">is_function</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_fundamental"><phrase role="index-entry-level-0">is_fundamental</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_integral"><phrase role="index-entry-level-0">is_integral</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_function_pointer"><phrase role="index-entry-level-0">is_member_function_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_object_pointer"><phrase role="index-entry-level-0">is_member_object_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_member_pointer"><phrase role="index-entry-level-0">is_member_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_object"><phrase role="index-entry-level-0">is_object</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_pod</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pod"><phrase role="index-entry-level-1">is_pod</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">is_pointer</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_pointer"><phrase role="index-entry-level-1">is_pointer</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_polymorphic"><phrase role="index-entry-level-0">is_polymorphic</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_reference"><phrase role="index-entry-level-0">is_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_same"><phrase role="index-entry-level-0">is_same</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_scalar"><phrase role="index-entry-level-0">is_scalar</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_signed"><phrase role="index-entry-level-0">is_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.is_stateless"><phrase role="index-entry-level-0">is_stateless</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_union</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_union"><phrase role="index-entry-level-1">is_union</phrase></link></emphasis></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">User Defined Specializations</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_unsigned"><phrase role="index-entry-level-0">is_unsigned</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">is_void</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.is_void"><phrase role="index-entry-level-1">is_void</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.is_volatile"><phrase role="index-entry-level-0">is_volatile</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_83"><term>M</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.make_signed"><phrase role="index-entry-level-0">make_signed</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.make_unsigned"><phrase role="index-entry-level-0">make_unsigned</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_84"><term>O</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">one</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_volatile"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-1">two</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_const"><phrase role="index-entry-level-2">add_const</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-2">three</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.add_cv"><phrase role="index-entry-level-3">add_cv</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_85"><term>P</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.promote"><phrase role="index-entry-level-0">promote</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_86"><term>R</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">rank</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.rank"><phrase role="index-entry-level-1">rank</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_all_extents"><phrase role="index-entry-level-0">remove_all_extents</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_const"><phrase role="index-entry-level-0">remove_const</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_cv"><phrase role="index-entry-level-0">remove_cv</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">remove_extent</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><emphasis role="bold"><link linkend="boost_typetraits.reference.remove_extent"><phrase role="index-entry-level-1">remove_extent</phrase></link></emphasis></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_pointer"><phrase role="index-entry-level-0">remove_pointer</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_reference"><phrase role="index-entry-level-0">remove_reference</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.reference.remove_volatile"><phrase role="index-entry-level-0">remove_volatile</phrase></link></para></listitem><listitem><para><phrase role="index-entry-level-0">result_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.function_traits"><phrase role="index-entry-level-1">function_traits</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_87"><term>S</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">Support for Compiler Intrinsics</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_ALIGNMENT_OF</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_ASSIGN</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_CONSTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_NOTHROW_COPY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_ASSIGN</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_CONSTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_COPY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_TRIVIAL_DESTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_HAS_VIRTUAL_DESTRUCTOR</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_ABSTRACT</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_BASE_OF</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_CLASS</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_CONVERTIBLE</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_EMPTY</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_ENUM</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_POD</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_POLYMORPHIC</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intrinsics"><phrase role="index-entry-level-1">BOOST_IS_UNION</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_88"><term>T</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">This section contains one block that must not be indexed and one that should be.</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.ignored_block"><phrase role="index-entry-level-1">add_volatile</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">true_type</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.reference.integral_constant"><phrase role="index-entry-level-1">integral_constant</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">Type Traits that Transform One Type to Another</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.category.transform"><phrase role="index-entry-level-1">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><phrase role="index-entry-level-0">type-traits</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.background"><phrase role="index-entry-level-1">Background and Tutorial</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.intro"><phrase role="index-entry-level-1">Introduction</phrase></link></para></listitem></itemizedlist></listitem><listitem><para><link linkend="boost_typetraits.reference.type_with_alignment"><phrase role="index-entry-level-0">type_with_alignment</phrase></link></para></listitem></itemizedlist></listitem></varlistentry><varlistentry id="idx_id_89"><term>U</term><listitem><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><phrase role="index-entry-level-0">User Defined Specializations</phrase></para><itemizedlist mark="none" spacing="compact" role="index"><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_class</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_pod</phrase></link></para></listitem><listitem><para><link linkend="boost_typetraits.user_defined"><phrase role="index-entry-level-1">is_union</phrase></link></para></listitem></itemizedlist></listitem></itemizedlist></listitem></varlistentry></variablelist></index> + +</chapter>
\ No newline at end of file diff --git a/tools/auto_index/test/type_traits.docbook b/tools/auto_index/test/type_traits.docbook new file mode 100644 index 0000000000..64837d71a1 --- /dev/null +++ b/tools/auto_index/test/type_traits.docbook @@ -0,0 +1,6673 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +<!-- + +This file is based upon the type traits docs, but has had additional XML elements added to it +to ensure complete testing. + +--> + +<chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="boost_typetraits" rev:last-revision="$Date: 2008-11-28 12:41:45 +0000 (Fri, 28 Nov 2008) $"> + <chapterinfo><author> + <firstname>various</firstname> <surname>authors</surname> + </author><copyright> + <year>2000</year> <year>2006</year> <holder>Adobe Systems Inc, David Abrahams, + Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat + Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert + Ramey and Jeremy Siek</holder> + </copyright><legalnotice> + <para> + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) + </para> + </legalnotice></chapterinfo> + <title>Boost.TypeTraits</title> + <para> + A printer-friendly <ulink url="http://svn.boost.org/svn/boost/sandbox/pdf/type_traits/release/type_traits.pdf">PDF + version of this manual is also available</ulink>. + </para> + <section id="boost_typetraits.intro"> + <title><link linkend="boost_typetraits.intro"> Introduction</link></title> + <para> + The Boost type-traits library contains a set of very specific traits classes, + each of which encapsulate a single trait from the C++ type system; for example, + is a type a pointer or a reference type? Or does a type have a trivial constructor, + or a const-qualifier? + </para> + <para> + The type-traits classes share a unified design: each class inherits from a + the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. + </para> + </section> + <section id="boost_typetraits.background"> + <title><link linkend="boost_typetraits.background"> Background and Tutorial</link></title> + <para> + The following is an updated version of the article "C++ Type traits" + by John Maddock and Steve Cleary that appeared in the October 2000 issue of + <ulink url="http://www.ddj.com">Dr Dobb's Journal</ulink>. + </para> + <para> + Generic programming (writing code which works with any data type meeting a + set of requirements) has become the method of choice for providing reusable + code. However, there are times in generic programming when "generic" + just isn't good enough - sometimes the differences between types are too large + for an efficient generic implementation. This is when the traits technique + becomes important - by encapsulating those properties that need to be considered + on a type by type basis inside a traits class, we can minimize the amount of + code that has to differ from one type to another, and maximize the amount of + generic code. + </para> + <?dbfo keep-together="auto" ?> + <para> + <indexterm> + <primary>Foo1</primary> + </indexterm> + Consider an example: when working with character strings, one common operation + is to determine the length of a null terminated string. Clearly it's possible + to write generic code that can do this, but it turns out that there are much + more efficient methods available: for example, the C library functions <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">strlen</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">wcslen</phrase></computeroutput> + are usually written in assembler, and with suitable hardware support can be + considerably faster than a generic version written in C++. The authors of the + C++ standard library realized this, and abstracted the properties of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">wchar_t</phrase></computeroutput> + into the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput>. + Generic code that works with character strings can simply use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase><phrase role="special"><>::</phrase><phrase role="identifier">length</phrase></computeroutput> to determine the length of a null + terminated string, safe in the knowledge that specializations of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> will use the most appropriate + method available to them. + </para> + <anchor id="boost_typetraits.background.type_traits"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.type_traits">Type Traits</link> + </bridgehead> + <para> + Class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> is a classic + example of a collection of type specific properties wrapped up in a single + class - what Nathan Myers termed a <emphasis>baggage class</emphasis><link linkend="background.references">[1]</link>. In the Boost type-traits library, + we<link linkend="background.references">[2]</link> have written a set of very + specific traits classes, each of which encapsulate a single trait from the + C++ type system; for example, is a type a pointer or a reference type? Or does + a type have a trivial constructor, or a const-qualifier? The type-traits classes + share a unified design: each class inherits from a the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link> + otherwise. As we will show, these classes can be used in generic programming + to determine the properties of a given type and introduce optimizations that + are appropriate for that case. + </para> + <para> + The type-traits library also contains a set of classes that perform a specific + transformation on a type; for example, they can remove a top-level const or + volatile qualifier from a type. Each class that performs a transformation defines + a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of the transformation. All of the type-traits classes are + defined inside namespace <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase></computeroutput>; + for brevity, namespace-qualification is omitted in most of the code samples + given. + </para> + <anchor id="boost_typetraits.background.implementation"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.implementation">Implementation</link> + </bridgehead> + <para> + There are far too many separate classes contained in the type-traits library + to give a full implementation here - see the source code in the Boost library + for the full details - however, most of the implementation is fairly repetitive + anyway, so here we will just give you a flavor for how some of the classes + are implemented. Beginning with possibly the simplest class in the library, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput> inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + only if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + Here we define a primary version of the template class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_void">is_void</link></computeroutput>, + and provide a full-specialization when <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. While full specialization + of a template class is an important technique, sometimes we need a solution + that is halfway between a fully generic solution, and a full specialization. + This is exactly the situation for which the standards committee defined partial + template-class specialization. As an example, consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>: + here we needed a primary version that handles all the cases where T is not + a pointer, and a partial specialization to handle all the cases where T is + a pointer: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">*></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> +</programlisting> + <para> + The syntax for partial specialization is somewhat arcane and could easily occupy + an article in its own right; like full specialization, in order to write a + partial specialization for a class, you must first declare the primary template. + The partial specialization contains an extra <...> after the class name + that contains the partial specialization parameters; these define the types + that will bind to that partial specialization rather than the default template. + The rules for what can appear in a partial specialization are somewhat convoluted, + but as a rule of thumb if you can legally write two function overloads of the + form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">);</phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">U</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Then you can also write a partial specialization of the form: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + This rule is by no means foolproof, but it is reasonably simple to remember + and close enough to the actual rule to be useful for everyday use. + </para> + <para> + As a more complex example of partial specialization consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">></phrase></computeroutput>. This + class defines a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the same type as T but with any top-level array bounds removed; this + is an example of a traits class that performs a transformation on a type: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">[</phrase><phrase role="identifier">N</phrase><phrase role="special">]></phrase> +<phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase> +</programlisting> + <para> + The aim of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + is this: imagine a generic algorithm that is passed an array type as a template + parameter, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput> + provides a means of determining the underlying type of the array. For example + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">][</phrase><phrase role="number">5</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> would evaluate to the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">5</phrase><phrase role="special">]</phrase></computeroutput>. This example also shows that the number of + template parameters in a partial specialization does not have to match the + number in the default template. However, the number of parameters that appear + after the class name do have to match the number and type of the parameters + in the default template. + </para> + <anchor id="boost_typetraits.background.optimized_copy"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.optimized_copy">Optimized copy</link> + </bridgehead> + <para> + As an example of how the type traits classes can be used, consider the standard + library algorithm copy: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">Iter1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Iter2</phrase><phrase role="special">></phrase> +<phrase role="identifier">Iter2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">Iter1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter2</phrase> <phrase role="identifier">out</phrase><phrase role="special">);</phrase> +</programlisting> + <para> + Obviously, there's no problem writing a generic version of copy that works + for all iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput>; however, there are + some circumstances when the copy operation can best be performed by a call + to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. In order to implement + copy in terms of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> all + of the following conditions need to be met: + </para> + <itemizedlist> + <listitem> + Both of the iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must be pointers. + </listitem> + <listitem> + Both <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must point to the same type - excluding + const and volatile-qualifiers. + </listitem> + <listitem> + The type pointed to by <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> + must have a trivial assignment operator. + </listitem> + </itemizedlist> + <para> + By trivial assignment operator we mean that the type is either a scalar type<link linkend="background.references">[3]</link> or: + </para> + <itemizedlist> + <listitem> + The type has no user defined assignment operator. + </listitem> + <listitem> + The type does not have any data members that are references. + </listitem> + <listitem> + All base classes, and all data member objects must have trivial assignment + operators. + </listitem> + </itemizedlist> + <para> + If all these conditions are met then a type can be copied using <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> rather than using a compiler generated + assignment operator. The type-traits library provides a class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>, + such that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is true only if T has a trivial assignment + operator. This class "just works" for scalar types, but has to be + explicitly specialised for class/struct types that also happen to have a trivial + assignment operator. In other words if <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + gives the wrong answer, it will give the "safe" wrong answer - that + trivial assignment is not allowable. + </para> + <para> + The code for an optimized version of copy that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + where appropriate is given in <link linkend="boost_typetraits.examples.copy">the + examples</link>. The code begins by defining a template function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">do_copy</phrase></computeroutput> that performs a "slow but safe" + copy. The last parameter passed to this function may be either a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + or a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>. + Following that there is an overload of do<emphasis role="underline">copy that + uses `memcpy`: this time the iterators are required to actually be pointers + to the same type, and the final parameter must be a `</emphasis>_true_type<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">.</phrase> <phrase role="identifier">Finally</phrase><phrase role="special">,</phrase> <phrase role="identifier">the</phrase> <phrase role="identifier">version</phrase> + <phrase role="identifier">of</phrase> </computeroutput>copy<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="identifier">calls</phrase> + </computeroutput>do<emphasis role="underline">copy`, passing `</emphasis>_has_trivial_assign<value_type>()` + as the final parameter: this will dispatch to the optimized version where appropriate, + otherwise it will call the "slow but safe version". + </para> + <anchor id="boost_typetraits.background.was_it_worth_it_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.was_it_worth_it_">Was it worth it?</link> + </bridgehead> + <para> + It has often been repeated in these columns that "premature optimization + is the root of all evil" <link linkend="background.references">[4]</link>. + So the question must be asked: was our optimization premature? To put this + in perspective the timings for our version of copy compared a conventional + generic copy<link linkend="background.references">[5]</link> are shown in table + 1. + </para> + <para> + Clearly the optimization makes a difference in this case; but, to be fair, + the timings are loaded to exclude cache miss effects - without this accurate + comparison between algorithms becomes difficult. However, perhaps we can add + a couple of caveats to the premature optimization rule: + </para> + <itemizedlist> + <listitem> + If you use the right algorithm for the job in the first place then optimization + will not be required; in some cases, memcpy is the right algorithm. + </listitem> + <listitem> + If a component is going to be reused in many places by many people then optimizations + may well be worthwhile where they would not be so for a single case - in + other words, the likelihood that the optimization will be absolutely necessary + somewhere, sometime is that much higher. Just as importantly the perceived + value of the stock implementation will be higher: there is no point standardizing + an algorithm if users reject it on the grounds that there are better, more + heavily optimized versions available. + </listitem> + </itemizedlist> + <table frame="all"> <title>Time taken to copy 1000 elements using `copy<const + T*, T*>` (times in micro-seconds)</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Version + </para> + </entry><entry> + <para> + T + </para> + </entry><entry> + <para> + Time + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 0.99 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + char + </para> + </entry><entry> + <para> + 8.07 + </para> + </entry> + </row> + <row> + <entry> + <para> + "Optimized" copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 2.52 + </para> + </entry> + </row> + <row> + <entry> + <para> + Conventional copy + </para> + </entry><entry> + <para> + int + </para> + </entry><entry> + <para> + 8.02 + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <anchor id="boost_typetraits.background.pair_of_references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.pair_of_references">Pair of References</link> + </bridgehead> + <para> + The optimized copy example shows how type traits may be used to perform optimization + decisions at compile-time. Another important usage of type traits is to allow + code to compile that otherwise would not do so unless excessive partial specialization + is used. This is possible by delegating partial specialization to the type + traits classes. Our example for this form of usage is a pair that can hold + references <link linkend="background.references">[6]</link>. + </para> + <para> + First, let us examine the definition of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput>, omitting + the comparison operators, default constructor, and template copy constructor + for simplicity: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">&</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Now, this "pair" cannot hold references as it currently stands, because + the constructor would require taking a reference to a reference, which is currently + illegal <link linkend="background.references">[7]</link>. Let us consider what + the constructor's parameters would have to be in order to allow "pair" + to hold non-reference types, references, and constant references: + </para> + <table frame="all"> <title>Required Constructor Argument Types</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of parameter to initializing constructor + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + A little familiarity with the type traits classes allows us to construct a + single mapping that allows us to determine the type of parameter from the type + of the contained class. The type traits classes provide a transformation <link linkend="boost_typetraits.reference.add_reference">add_reference</link>, which + adds a reference to its type, unless it is already a reference. + </para> + <table frame="all"> <title>Using add_reference to synthesize the correct constructor + type</title> + <tgroup cols="3"> + <thead> + <row> + <entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase></computeroutput> + </para> + </entry><entry> + <para> + Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + T + </para> + </entry><entry> + <para> + const T + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + <row> + <entry> + <para> + T & + </para> + </entry><entry> + <para> + T & [8] + </para> + </entry><entry> + <para> + T & + </para> + </entry> + </row> + <row> + <entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry><entry> + <para> + const T & + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + <para> + This allows us to build a primary template definition for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> + that can contain non-reference types, reference types, and constant reference + types: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase> +<phrase role="special">{</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase> +<phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase> + +<phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> + <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> +<phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + Add back in the standard comparison operators, default constructor, and template + copy constructor (which are all the same), and you have a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput> that + can hold reference types! + </para> + <para> + This same extension could have been done using partial template specialization + of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>, but to specialize + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> in this way would require + three partial specializations, plus the primary template. Type traits allows + us to define a single primary template that adjusts itself auto-magically to + any of these partial specializations, instead of a brute-force partial specialization + approach. Using type traits in this fashion allows programmers to delegate + partial specialization to the type traits classes, resulting in code that is + easier to maintain and easier to understand. + </para> + <anchor id="boost_typetraits.background.conclusion"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.conclusion">Conclusion</link> + </bridgehead> + <para> + We hope that in this article we have been able to give you some idea of what + type-traits are all about. A more complete listing of the available classes + are in the boost documentation, along with further examples using type traits. + Templates have enabled C++ uses to take the advantage of the code reuse that + generic programming brings; hopefully this article has shown that generic programming + does not have to sink to the lowest common denominator, and that templates + can be optimal as well as generic. + </para> + <anchor id="boost_typetraits.background.acknowledgements"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.acknowledgements">Acknowledgements</link> + </bridgehead> + <para> + The authors would like to thank Beman Dawes and Howard Hinnant for their helpful + comments when preparing this article. + </para> + <anchor id="background.references"/> <anchor id="boost_typetraits.background.references"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.background.references">References</link> + </bridgehead> + <orderedlist inheritnum="ignore" continuation="restarts"> + <listitem> + Nathan C. Myers, C++ Report, June 1995. + </listitem> + <listitem> + The type traits library is based upon contributions by Steve Cleary, Beman + Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org. + </listitem> + <listitem> + A scalar type is an arithmetic type (i.e. a built-in integer or floating + point type), an enumeration type, a pointer, a pointer to member, or a const- + or volatile-qualified version of one of these types. + </listitem> + <listitem> + This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg + 268. + </listitem> + <listitem> + The test code is available as part of the boost utility library (see algo_opt_examples.cpp), + the code was compiled with gcc 2.95 with all optimisations turned on, tests + were conducted on a 400MHz Pentium II machine running Microsoft Windows 98. + </listitem> + <listitem> + John Maddock and Howard Hinnant have submitted a "compressed_pair" + library to Boost, which uses a technique similar to the one described here + to hold references. Their pair also uses type traits to determine if any + of the types are empty, and will derive instead of contain to conserve space + -- hence the name "compressed". + </listitem> + <listitem> + This is actually an issue with the C++ Core Language Working Group (issue + #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow + a "reference to a reference to T" to mean the same thing as a "reference + to T", but only in template instantiation, in a method similar to multiple + cv-qualifiers. + </listitem> + <listitem> + For those of you who are wondering why this shouldn't be const-qualified, + remember that references are always implicitly constant (for example, you + can't re-assign a reference). Remember also that "const T &" + is something completely different. For this reason, cv-qualifiers on template + type arguments that are references are ignored. + </listitem> + </orderedlist> + </section> + <section id="boost_typetraits.category"> + <title><link linkend="boost_typetraits.category"> Type Traits by Category</link></title> + <section id="boost_typetraits.category.value_traits"> + <title><link linkend="boost_typetraits.category.value_traits"> Type Traits + that Describe the Properties of a Type</link></title> + <para> + <indexterm> + <primary>Foo2</primary> + <secondary>Bar2</secondary> + </indexterm> + These traits are all <emphasis>value traits</emphasis>, which is to say the + traits classes all inherit from <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link>, + and are used to access some numerical property of a type. Often this is a + simple true or false Boolean value, but in a few cases may be some other + integer value (for example when dealing with type alignments, or array bounds: + see <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.alignment_of">alignment_of</link></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.rank">rank</link></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.extent">extent</link></computeroutput>). + </para> + <section id="boost_typetraits.category.value_traits.primary"> + <title><link linkend="boost_typetraits.category.value_traits.primary"> Categorizing + a Type</link></title> + <para> + These traits identify what "kind" of type some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is. These are split into two groups: + primary traits which are all mutually exclusive, and composite traits that + are compositions of one or more primary traits. + </para> + <para> + For any given type, exactly one primary type trait will inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + and all the others will inherit from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + in other words these traits are mutually exclusive. + </para> + <para> + This means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + will only ever be true for built-in types; if you want to check for a user-defined + class type that behaves "as if" it is an integral or floating + point type, then use the <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric_limits</phrase> + <phrase role="keyword">template</phrase></computeroutput> instead. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_array">is_array</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_complex">is_complex</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_enum">is_enum</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">;</phrase> +</programlisting> + <para> + The following traits are made up of the union of one or more type categorizations. + A type may belong to more than one of these categories, in addition to + one of the primary categories. + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_arithmetic">is_arithmetic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_compound">is_compound</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_object">is_object</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_scalar">is_scalar</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.properties"> + <title><link linkend="boost_typetraits.category.value_traits.properties"> + General Type Properties</link></title> + <para> + The following templates describe the general properties of a type. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.alignment_of">alignment_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_default_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy_constructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_abstract">is_abstract</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_const">is_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_empty">is_empty</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_signed">is_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_unsigned">is_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_volatile">is_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.extent">extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.value_traits.relate"> + <title><link linkend="boost_typetraits.category.value_traits.relate"> Relationships + Between Two Types</link></title> + <para> + These templates determine the whether there is a relationship between two + types: + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_base_of">is_base_of</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.category.transform"> + <title><link linkend="boost_typetraits.category.transform"> Type Traits that + Transform One Type to Another</link></title> + <para> + The following templates transform one type to another, based upon some well-defined + rule. Each template has a single member called <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + that is the result of applying the transformation to the template argument + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Synopsis:</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_const">add_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_cv">add_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_pointer">add_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_volatile">add_volatile</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.decay">decay</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_signed">make_signed</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_unsigned">make_unsigned</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.promote">promote</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_all_extents">remove_all_extents</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_const">remove_const</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_cv">remove_cv</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_reference">remove_reference</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_volatile">remove_volatile</link><phrase role="special">;</phrase> +</programlisting> + <anchor id="boost_typetraits.category.transform.broken_compiler_workarounds_"/> + <bridgehead renderas="sect4"> + <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">Broken + Compiler Workarounds:</link> + </bridgehead> + <para> + For all of these templates support for partial specialization of class templates + is required to correctly implement the transformation. On the other hand, + practice shows that many of the templates from this category are very useful, + and often essential for implementing some generic libraries. Lack of these + templates is often one of the major limiting factors in porting those libraries + to compilers that do not yet support this language feature. As some of these + compilers are going to be around for a while, and at least one of them is + very wide-spread, it was decided that the library should provide workarounds + where possible. + </para> + <para> + The basic idea behind the workaround is to manually define full specializations + of all type transformation templates for all fundamental types, and all their + 1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide + a user-level macro that will define all the explicit specializations needed + for any user-defined type T. + </para> + <para> + The first part guarantees the successful compilation of something like this: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="special">...</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +</programlisting> + <para> + and the second part provides the library's users with a mechanism to make + the above code work not only for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> or other built-in type, + but for their own types as well: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">namespace</phrase> <phrase role="identifier">myspace</phrase><phrase role="special">{</phrase> + <phrase role="keyword">struct</phrase> <phrase role="identifier">MyClass</phrase> <phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +<phrase role="comment">// declare this at global scope: +</phrase><phrase role="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase><phrase role="special">(</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">)</phrase> +<phrase role="comment">// transformations on myspace::MyClass now work: +</phrase><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase> +<phrase role="comment">// etc. +</phrase></programlisting> + <para> + Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates + to nothing on those compilers that <emphasis role="bold">do</emphasis> support + partial specialization. + </para> + </section> + <section id="boost_typetraits.category.alignment"> + <title><link linkend="boost_typetraits.category.alignment"> Synthesizing Types + with Specific Alignments</link></title> + <para> + Some low level memory management routines need to synthesize a POD type with + specific alignment properties. The template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link></computeroutput> + finds the smallest type with a specified alignment, while template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link></computeroutput> + creates a type with a specific size and alignment. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link><phrase role="special">;</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link><phrase role="special">;</phrase> +</programlisting> + </section> + <section id="boost_typetraits.category.function"> + <title><link linkend="boost_typetraits.category.function"> Decomposing Function + Types</link></title> + <para> + The class template <link linkend="boost_typetraits.reference.function_traits">function_traits</link> + extracts information from function types (see also <link linkend="boost_typetraits.reference.is_function">is_function</link>). + This traits class allows you to tell how many arguments a function takes, + what those argument types are, and what the return type is. + </para> + <para> + <emphasis role="bold">Synopsis</emphasis> + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.function_traits">function_traits</link><phrase role="special">;</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.user_defined"> + <title><link linkend="boost_typetraits.user_defined"> User Defined Specializations</link></title> + <para> + Occationally the end user may need to provide their own specialization for + one of the type traits - typically where intrinsic compiler support is required + to implement a specific trait fully. These specializations should derive from + boost::<link linkend="boost_typetraits.reference.integral_constant">true_type</link> + or boost::<link linkend="boost_typetraits.reference.integral_constant">false_type</link> + as appropriate: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> +<phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase> + +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_pod</phrase><phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">my_union</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">char</phrase> <phrase role="identifier">c</phrase><phrase role="special">;</phrase> + <phrase role="keyword">int</phrase> <phrase role="identifier">i</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">namespace</phrase> <phrase role="identifier">boost</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_pod</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase> + + <phrase role="keyword">template</phrase><phrase role="special"><></phrase> + <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special"><</phrase><phrase role="identifier">my_union</phrase><phrase role="special">></phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.intrinsics"> + <title><link linkend="boost_typetraits.intrinsics"> Support for Compiler Intrinsics</link></title> + <para> + There are some traits that can not be implemented within the current C++ language: + to make these traits "just work" with user defined types, some kind + of additional help from the compiler is required. Currently (April 2008) Visual + C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other + compilers will no doubt follow in due course. + </para> + <para> + The Following traits classes always need compiler support to do the right thing + for all types (but all have safe fallback positions if this support is unavailable): + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_union">is_union</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_pod">is_pod</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link> + </listitem> + </itemizedlist> + <para> + The following traits classes can't be portably implemented in the C++ language, + although in practice, the implementations do in fact do the right thing on + all the compilers we know about: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_empty">is_empty</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link> + </listitem> + </itemizedlist> + <para> + The following traits classes are dependent on one or more of the above: + </para> + <itemizedlist> + <listitem> + <link linkend="boost_typetraits.reference.is_class">is_class</link> + </listitem> + <listitem> + <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link> + </listitem> + </itemizedlist> + <para> + The hooks for compiler-intrinsic support are defined in <ulink url="../../../../boost/type_traits/intrinsics.hpp">boost/type_traits/intrinsics.hpp</ulink>, + adding support for new compilers is simply a matter of defining one of more + of the following macros: + </para> + <table frame="all"> <title>Macros for Compiler Intrinsics</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + BOOST_IS_UNION(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a union type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + BOOST_IS_POD(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a POD type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_EMPTY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an empty struct or union + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if the default constructor for T is trivial (i.e. + has no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial copy constructor (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial assignment operator (and can + therefore be replaced by a call to memcpy) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T has a trivial destructor (i.e. ~T() has + no effect) + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_CONSTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">x</phrase><phrase role="special">;</phrase></computeroutput> + can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_COPY(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">(</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_NOTHROW_ASSIGN(T) + </para> + </entry><entry> + <para> + Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="identifier">t</phrase><phrase role="special">,</phrase> + <phrase role="identifier">u</phrase><phrase role="special">;</phrase> + <phrase role="identifier">t</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">u</phrase></computeroutput> can not throw + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_HAS_VIRTUAL_DESTRUCTOR(T) + </para> + </entry><entry> + <para> + Should evaluate to true T has a virtual destructor + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ABSTRACT(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is an abstract type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_BASE_OF(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a base class of U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CLASS(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a class type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_CONVERTIBLE(T,U) + </para> + </entry><entry> + <para> + Should evaluate to true if T is convertible to U + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_ENUM(T) + </para> + </entry><entry> + <para> + Should evaluate to true is T is an enum + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_IS_POLYMORPHIC(T) + </para> + </entry><entry> + <para> + Should evaluate to true if T is a polymorphic type + </para> + </entry> + </row> + <row> + <entry> + <para> + BOOST_ALIGNMENT_OF(T) + </para> + </entry><entry> + <para> + Should evaluate to the alignment requirements of type T. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.mpl"> + <title><link linkend="boost_typetraits.mpl"> MPL Interoperability</link></title> + <para> + All the value based traits in this library conform to MPL's requirements for + an <ulink url="../../../../libs/mpl/doc/refmanual/integral-constant.html">Integral + Constant type</ulink>: that includes a number of rather intrusive workarounds + for broken compilers. + </para> + <para> + Purely as an implementation detail, this means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">true_</phrase></computeroutput></ulink>, + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">false_</phrase></computeroutput></ulink>, + and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> + <phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput> + inherits from <ulink url="../../../../libs/mpl/doc/refmanual/integral-c.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">integral_c</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">v</phrase><phrase role="special">></phrase></computeroutput></ulink> + (provided <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>) + </para> + </section> + <section id="boost_typetraits.examples"> + <title><link linkend="boost_typetraits.examples"> Examples</link></title> + <section id="boost_typetraits.examples.copy"> + <title><link linkend="boost_typetraits.examples.copy"> An Optimized Version + of std::copy</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">copy</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> + to optimise the copy operation (see <ulink url="../../examples/copy_example.cpp">copy_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// opt::copy +</phrase><phrase role="comment">// same semantics as std::copy +</phrase><phrase role="comment">// calls memcpy where appropriate. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="identifier">I2</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">out</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">out</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">memcpy</phrase><phrase role="special">(</phrase><phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="special">(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">)*</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">));</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">+(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can copy with memcpy if T has a trivial assignment operator, +</phrase> <phrase role="comment">// and if the iterator arguments are actually pointers (this last +</phrase> <phrase role="comment">// requirement we detect with overload resolution): +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">value_type</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.fill"> + <title><link linkend="boost_typetraits.examples.fill"> An Optimised Version + of std::fill</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">fill</phrase></computeroutput> + that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput> + to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memset</phrase></computeroutput> + to optimise the fill operation (see <ulink url="../../examples/fill_example.cpp">fill_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// fill +</phrase><phrase role="comment">// same as std::fill, but uses memset where appropriate +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">>&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="special">*</phrase><phrase role="identifier">first</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">memset</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&</phrase> <phrase role="identifier">val</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// We can do an optimised fill if T has a trivial assignment +</phrase> <phrase role="comment">// operator and if it's size is one: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> <phrase role="special">&&</phrase> <phrase role="special">(</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase> <phrase role="special">==</phrase> <phrase role="number">1</phrase><phrase role="special">)></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.destruct"> + <title><link linkend="boost_typetraits.examples.destruct"> An Example that + Omits Destructor Calls For Types with Trivial Destructors</link></title> + <para> + Demonstrates a simple algorithm that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">__has_trivial_destruct</phrase></computeroutput> + to determine whether to destructors need to be called (see <ulink url="../../examples/trivial_destructor_example.cpp">trivial_destructor_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// algorithm destroy_array: +</phrase><phrase role="comment">// The reverse of std::unitialized_copy, takes a block of +</phrase><phrase role="comment">// initialized memory and calls destructors on all objects therein. +</phrase><phrase role="comment">// +</phrase> +<phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase> + <phrase role="special">{</phrase> + <phrase role="identifier">first</phrase><phrase role="special">->~</phrase><phrase role="identifier">T</phrase><phrase role="special">();</phrase> + <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase> + <phrase role="special">}</phrase> +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> <phrase role="comment">// namespace detail +</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p2</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">p2</phrase><phrase role="special">,</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.iter"> + <title><link linkend="boost_typetraits.examples.iter"> An improved Version + of std::iter_swap</link></title> + <para> + Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + that use type traits to determine whether an it's arguments are proxying + iterators or not, if they're not then it just does a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase></computeroutput> + of it's dereferenced arguments (the same as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput> + does), however if they are proxying iterators then takes special care over + the swap to ensure that the algorithm works correctly for both proxying iterators, + and even iterators of different types (see <ulink url="../../examples/iter_swap_example.cpp">iter_swap_example.cpp</ulink>): + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">// +</phrase><phrase role="comment">// iter_swap: +</phrase><phrase role="comment">// tests whether iterator is a proxying iterator or not, and +</phrase><phrase role="comment">// uses optimal form accordingly: +</phrase><phrase role="comment">// +</phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">v_t</phrase><phrase role="special">;</phrase> + <phrase role="identifier">v_t</phrase> <phrase role="identifier">v</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">one</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">one</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">;</phrase> + <phrase role="special">*</phrase><phrase role="identifier">two</phrase> <phrase role="special">=</phrase> <phrase role="identifier">v</phrase><phrase role="special">;</phrase> +<phrase role="special">}</phrase> +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">></phrase> +<phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">using</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase><phrase role="special">;</phrase> + <phrase role="identifier">swap</phrase><phrase role="special">(*</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> + +<phrase role="special">}</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">iter_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">two</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="comment">// +</phrase> <phrase role="comment">// See is both arguments are non-proxying iterators, +</phrase> <phrase role="comment">// and if both iterator the same type: +</phrase> <phrase role="comment">// +</phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I1</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r1_t</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">I2</phrase><phrase role="special">>::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">;</phrase> + + <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> + <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special"><</phrase><phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special"><</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase><phrase role="special">></phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase> + + <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + <section id="boost_typetraits.examples.to_double"> + <title><link linkend="boost_typetraits.examples.to_double"> Convert Numeric + Types and Enums to double</link></title> + <para> + Demonstrates a conversion of <ulink url="../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric + Types</ulink> and enum types to double: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">inline</phrase> <phrase role="keyword">double</phrase> <phrase role="identifier">to_double</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">value</phrase><phrase role="special">)</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">promoted</phrase><phrase role="special">;</phrase> + <phrase role="keyword">return</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric</phrase><phrase role="special">::</phrase><phrase role="identifier">converter</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase><phrase role="identifier">promoted</phrase><phrase role="special">>::</phrase><phrase role="identifier">convert</phrase><phrase role="special">(</phrase><phrase role="identifier">value</phrase><phrase role="special">);</phrase> +<phrase role="special">}</phrase> +</programlisting> + </section> + </section> + <section id="boost_typetraits.reference"> + <title><link linkend="boost_typetraits.reference"> Alphabetical Reference</link></title> + <section id="boost_typetraits.reference.add_const"> + <title><link linkend="boost_typetraits.reference.add_const"> add_const</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_cv"> + <title><link linkend="boost_typetraits.reference.add_cv"> add_cv</link></title> + <indexterm type="class_name"> + <primary>one</primary> + <secondary>two</secondary> + <tertiary>three</tertiary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_pointer"> + <title><link linkend="boost_typetraits.reference.add_pointer"> add_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + <para> + The rationale for this template is that it produces the same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">TYPEOF</phrase><phrase role="special">(&</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput>, where + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">t</phrase></computeroutput> is an object of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_reference"> + <title><link linkend="boost_typetraits.reference.add_reference"> add_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is not a reference type then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">&</phrase></computeroutput>, otherwise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.add_volatile"> + <title><link linkend="boost_typetraits.reference.add_volatile"> add_volatile</link></title> + <indexterm type="class_name"> + <primary>one</primary> + </indexterm> + + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.aligned_storage"> + <title><link linkend="boost_typetraits.reference.aligned_storage"> aligned_storage</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">aligned_storage</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with size + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Size</phrase></computeroutput> and an alignment that + is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">aligned_storage</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.alignment_of"> + <title><link linkend="boost_typetraits.reference.alignment_of"> alignment_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">alignment_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template alignment<emphasis role="underline">of inherits from `</emphasis>_integral_constant<std::size_t, + ALIGNOF(T)><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">,</phrase> <phrase role="identifier">where</phrase> + </computeroutput>ALIGNOF(T)` is the alignment of type T. + </para> + <para> + <emphasis>Note: strictly speaking you should only rely on the value of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> being + a multiple of the true alignment of T, although in practice it does compute + the correct value in all the cases we know about.</emphasis> + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">alignment_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">char</phrase><phrase role="special">)></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + with value <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.decay"> + <title><link linkend="boost_typetraits.reference.decay"> decay</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">decay</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> Let <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + be the result of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput>, then if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> + is an array type, the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">>*</phrase></computeroutput>, + otherwise if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> is a function + type then the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase><phrase role="special">*</phrase></computeroutput>, otherwise the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">decay</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.extent"> + <title><link linkend="boost_typetraits.reference.extent"> extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">extent</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template extent inherits + from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is the number of elements in the N'th array + dimention of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">N</phrase> <phrase role="special">></phrase> + <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput>, or if the N'th array bound is incomplete, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">],</phrase> + <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>4</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">],</phrase> <phrase role="number">1</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.floating_point_promotion"> + <title><link linkend="boost_typetraits.reference.floating_point_promotion"> + floating_point_promotion</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">floating_point_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If floating point promotion can be + applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies floating point promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">float</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.function_traits"> + <title><link linkend="boost_typetraits.reference.function_traits"> function_traits</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">F</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">function_traits</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">arity</phrase> <phrase role="special">=</phrase> <replaceable>see-below</replaceable><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">result_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> arg<replaceable>N</replaceable>_type<phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + The class template function_traits will only compile if: + </para> + <itemizedlist> + <listitem> + The compiler supports partial specialization of class templates. + </listitem> + <listitem> + The template argument <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput> + is a <emphasis>function type</emphasis>, note that this <emphasis><emphasis role="bold">is not</emphasis></emphasis> the same thing as a <emphasis>pointer + to a function</emphasis>. + </listitem> + </itemizedlist> + <tip> + <para> + function_traits is intended to introspect only C++ functions of the form + R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member + functions. To convert a function pointer type to a suitable type use <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link>. + </para> + </tip> + <table frame="all"> <title>Function Traits Members</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Member + </para> + </entry><entry> + <para> + Description + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that gives the number of arguments + accepted by the function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type returned by function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="identifier">F</phrase><phrase role="special">>::</phrase>arg<replaceable>N</replaceable>_type</computeroutput> + </para> + </entry><entry> + <para> + The <replaceable>N</replaceable>th argument type of function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="number">1</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">N</phrase> <phrase role="special"><=</phrase> + <phrase role="identifier">arity</phrase></computeroutput> of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 0. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 1. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + An integral constant expression that has the value 4. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">result_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">long</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arg1_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg4_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase><phrase role="special">*</phrase></computeroutput>. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)>::</phrase><phrase role="identifier">arg5_type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: there is no <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">arg5_type</phrase></computeroutput> + since there are only four arguments. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">arity</phrase></computeroutput> + </para> + </entry><entry> + <para> + A compiler error: argument type is a <emphasis>function pointer</emphasis>, + and not a <emphasis>function type</emphasis>. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.has_nothrow_assign"> + <title><link linkend="boost_typetraits.reference.has_nothrow_assign"> has_nothrow_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_assign</phrase></computeroutput> + will never report that a class or struct has a non-throwing assignment-operator; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler support to ensure that this trait "just + works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_constructor"> + <title><link linkend="boost_typetraits.reference.has_nothrow_constructor"> + has_nothrow_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_constructor</phrase></computeroutput> + will never report that a class or struct has a non-throwing default-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_copy"> + <title><link linkend="boost_typetraits.reference.has_nothrow_copy"> has_nothrow_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a non-throwing copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_copy</phrase></computeroutput> + will never report that a class or struct has a non-throwing copy-constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual + C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to ensure that this trait "just works". + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.has_nothrow_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_nothrow_cp_cons"> has_nothrow_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_no_throw_def_cons"> + <title><link linkend="boost_typetraits.reference.has_no_throw_def_cons"> has_nothrow_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_assign"> + <title><link linkend="boost_typetraits.reference.has_trivial_assign"> has_trivial_assign</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial assignment-operator then the operator has the same + effect as copying the bits of one object to the other: calls to the operator + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_assign + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p11. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_constructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_constructor"> + has_trivial_constructor</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial default-constructor then the constructor have no + effect: calls to the constructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_constructor + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.1p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_copy"> + <title><link linkend="boost_typetraits.reference.has_trivial_copy"> has_trivial_copy</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> + +<phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + These two traits are synonyms for each other. + </para> + <para> + If a type has a trivial copy-constructor then the constructor has the same + effect as copying the bits of one object to the other: calls to the constructor + can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_copy + will never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_trivial_cp_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_cp_cons"> has_trivial_copy_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_def_cons"> + <title><link linkend="boost_typetraits.reference.has_trivial_def_cons"> has_trivial_default_constructor</link></title> + <para> + See <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>. + </para> + </section> + <section id="boost_typetraits.reference.has_trivial_destructor"> + <title><link linkend="boost_typetraits.reference.has_trivial_destructor"> has_trivial_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a trivial destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + If a type has a trivial destructor then the destructor has no effect: calls + to the destructor can be safely omitted. Note that using meta-programming + to omit a call to a single trivial-constructor call is of no benefit whatsoever. + However, if loops and/or exception handling code can also be omitted, then + some benefit in terms of code size and speed can be obtained. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, has_trivial_destructor + will never report that a user-defined class or struct has a trivial destructor; + this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW + 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect user-defined classes with trivial constructors. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4p3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.has_virtual_destructor"> + <title><link linkend="boost_typetraits.reference.has_virtual_destructor"> has_virtual_destructor</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">has_virtual_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + type with a virtual destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This trait is provided + for completeness, since it's part of the Technical Report on C++ Library + Extensions. However, there is currently no way to portably implement this + trait. The default version provided always inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>, + and has to be explicitly specialized for types with virtual destructors unless + the compiler used has compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + that enable the trait to do the right thing: currently (May 2005) only Visual + C++ 8 and GCC-4.3 have the necessary <link linkend="boost_typetraits.intrinsics">intrinsics</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_virtual_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.integral_constant"> + <title><link linkend="boost_typetraits.reference.integral_constant"> integral_constant</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_constant</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">></phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase> + <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> + +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">true</phrase><phrase role="special">></phrase> <phrase role="identifier">true_type</phrase><phrase role="special">;</phrase> +<phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special"><</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">false</phrase><phrase role="special">></phrase> <phrase role="identifier">false_type</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + Class template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_constant</phrase></computeroutput> + is the common base class for all the value-based type traits. The two typedef's + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">true_type</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">false_type</phrase></computeroutput> are provided for convenience: + most of the value traits are Boolean properties and so will inherit from + one of these. + </para> + </section> + <section id="boost_typetraits.reference.integral_promotion"> + <title><link linkend="boost_typetraits.reference.integral_promotion"> integral_promotion</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">integral_promotion</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral promotion can be applied + to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, then + applies integral promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field). + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">integral_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special"><</phrase><phrase role="keyword">enum</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">float_round_style</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.is_abstract"> + <title><link linkend="boost_typetraits.reference.is_abstract"> is_abstract</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_abstract</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + abstract type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_abstract</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The compiler must + support DR337 (as of April 2005: GCC 3.4, VC++ 7.1 (and later), Intel C++ + 7 (and later), and Comeau 4.3.2). Otherwise behaves the same as <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>; + this is the "safe fallback position" for which polymorphic types + are always regarded as potentially abstract. The macro BOOST_NO_IS_ABSTRACT + is used to signify that the implementation is buggy, users should check for + this in their own code if the "safe fallback" is not suitable for + their particular use-case. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">abc</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">abc</phrase><phrase role="special">()</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">abc</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_arithmetic"> + <title><link linkend="boost_typetraits.reference.is_arithmetic"> is_arithmetic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_arithmetic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + arithmetic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Arithmetic types include integral and floating point types (see also <link linkend="boost_typetraits.reference.is_integral">is_integral</link> and + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_arithmetic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_array"> + <title><link linkend="boost_typetraits.reference.is_array"> is_array</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_array</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + array type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.4. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_array</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can give the wrong result with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_base_of"> + <title><link linkend="boost_typetraits.reference.is_base_of"> is_base_of</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_base_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If Base is base class of type + Derived or if both types are the same then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + This template will detect non-public base classes, and ambiguous base classes. + </para> + <para> + Note that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">X</phrase><phrase role="special">,</phrase><phrase role="identifier">X</phrase><phrase role="special">></phrase></computeroutput> will always inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>. + <emphasis role="bold">This is the case even if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">X</phrase></computeroutput> + is not a class type</emphasis>. This is a change in behaviour from Boost-1.33 + in order to track the Technical Report on C++ Library Extensions. + </para> + <para> + Types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput> must not be incomplete types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_base_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. There are some older compilers which + will produce compiler errors if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> + is a private base class of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>, + or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> is an ambiguous + base of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>. These compilers + include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and + older versions of EDG based compilers. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase> <phrase role="special">:</phrase> + <phrase role="keyword">public</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Base</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>: a class is regarded as it's + own base. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_class"> + <title><link linkend="boost_typetraits.reference.is_class"> is_class</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_class</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + class type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types, as a result this type will erroneously inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> for + union types. See also <link linkend="boost_typetraits.reference.is_union">is_union</link>. + Currently (May 2005) only Visual C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to correctly identify union types, and therefore make is_class function correctly. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">MyClass</phrase><phrase role="special">;</phrase></computeroutput> then: + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_complex"> + <title><link linkend="boost_typetraits.reference.is_complex"> is_complex</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_complex</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is a complex number type then true (of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">complex</phrase><phrase role="special"><</phrase><phrase role="identifier">U</phrase><phrase role="special">></phrase></computeroutput> + for some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>), otherwise + false. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 26.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_complex</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + <section id="boost_typetraits.reference.is_compound"> + <title><link linkend="boost_typetraits.reference.is_compound"> is_compound</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_compound</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + compound type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Any type that is not a fundamental type is a compound type (see also <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link>). + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_compound</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">MyEnum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_const"> + <title><link linkend="boost_typetraits.reference.is_const"> is_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_const</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) const-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the const-qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_convertible"> + <title><link linkend="boost_typetraits.reference.is_convertible"> is_convertible</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_convertible</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If an imaginary lvalue of type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> is convertible to type + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type From must not be an incomplete type. + </para> + <para> + Type To must not be an incomplete, or function type. + </para> + <para> + No types are considered to be convertible to array types or abstract-class + types. + </para> + <para> + This template can not detect whether a converting-constructor is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> or not: if type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">private</phrase></computeroutput> converting constructor + from type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> then instantiating + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="identifier">To</phrase><phrase role="special">></phrase></computeroutput> + will produce a compiler error. For this reason <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase></computeroutput> + can not be used to determine whether a type has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> + copy-constructor or not. + </para> + <para> + This template will also produce compiler errors if the conversion is ambiguous, + for example: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">B</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">C</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">D</phrase> <phrase role="special">:</phrase> <phrase role="identifier">B</phrase><phrase role="special">,</phrase> <phrase role="identifier">C</phrase> <phrase role="special">{};</phrase> +<phrase role="comment">// This produces a compiler error, the conversion is ambiguous: +</phrase><phrase role="keyword">bool</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">D</phrase><phrase role="special">*,</phrase><phrase role="identifier">A</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase><phrase role="special">;</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4 and 8.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> This template is + currently broken with Borland C++ Builder 5 (and earlier), for constructor-based + conversions, and for the Metrowerks 7 (and earlier) compiler in all cases. + If the compiler does not support <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_abstract">is_abstract</link></computeroutput>, + then the template parameter <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> + must not be an abstract type. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the conversion would require a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const_cast</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&,</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_empty"> + <title><link linkend="boost_typetraits.reference.is_empty"> is_empty</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_empty</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an empty class type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10p5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> In order to correctly + detect empty classes this trait relies on either: + </para> + <itemizedlist> + <listitem> + the compiler implementing zero sized empty base classes, or + </listitem> + <listitem> + the compiler providing <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to detect empty classes. + </listitem> + </itemizedlist> + <para> + Can not be used with incomplete types. + </para> + <para> + Can not be used with union types, until is_union can be made to work. + </para> + <para> + If the compiler does not support partial-specialization of class templates, + then this template can not be used with abstract types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">empty_class</phrase> + <phrase role="special">{};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_enum"> + <title><link linkend="boost_typetraits.reference.is_enum"> is_enum</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_enum</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + enum type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_enum</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Requires a correctly + functioning <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template; this means that is_enum is currently broken under Borland C++ Builder + 5, and for the Metrowerks compiler prior to version 8, other compilers should + handle this template just fine. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">enum</phrase> <phrase role="identifier">my_enum</phrase> + <phrase role="special">{</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_floating_point"> + <title><link linkend="boost_typetraits.reference.is_floating_point"> is_floating_point</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_floating_point</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + floating point type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_floating_point</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_function"> + <title><link linkend="boost_typetraits.reference.is_function"> is_function</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_function</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + function type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Note that this template does not detect <emphasis>pointers to functions</emphasis>, + or <emphasis>references to functions</emphasis>, these are detected by <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> and <link linkend="boost_typetraits.reference.is_reference">is_reference</link> respectively: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="identifier">f1</phrase><phrase role="special">();</phrase> <phrase role="comment">// f1 is of function type. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f2</phrase><phrase role="special">*)();</phrase> <phrase role="comment">// f2 is a pointer to a function. +</phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f3</phrase><phrase role="special">&)();</phrase> <phrase role="comment">// f3 is a reference to a function. +</phrase></programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p1 and 8.3.5. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_function</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer type, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a reference to a function, not a function type. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: the argument in this case + is a pointer to a member function. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <tip> + <para> + Don't confuse function-types with pointers to functions: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> + <phrase role="identifier">f</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">);</phrase></computeroutput> + </para> + <para> + defines a function type, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase> <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a prototype for a function of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase></computeroutput>, + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">*</phrase> + <phrase role="identifier">pf</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">&</phrase> + <phrase role="identifier">fr</phrase> <phrase role="special">=</phrase> + <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput> + </para> + <para> + declares a pointer and a reference to the function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">foo</phrase></computeroutput>. + </para> + <para> + If you want to detect whether some type is a pointer-to-function then use: + </para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special"><</phrase><link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> + <phrase role="special">&&</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + </para> + <para> + or for pointers to member functions you can just use <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + directly. + </para> + </tip> + </section> + <section id="boost_typetraits.reference.is_fundamental"> + <title><link linkend="boost_typetraits.reference.is_fundamental"> is_fundamental</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_fundamental</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + fundamental type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Fundamental types include integral, floating point and void types (see also + <link linkend="boost_typetraits.reference.is_integral">is_integral</link>, + <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link> + and <link linkend="boost_typetraits.reference.is_void">is_void</link>) + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_fundamental</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_integral"> + <title><link linkend="boost_typetraits.reference.is_integral"> is_integral</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_integral</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + integral type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p7. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_integral</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_function_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_function_pointer"> + is_member_function_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_function_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member function then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a data member and not a member + function, see <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_object_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_object_pointer"> + is_member_object_pointer</link></title> +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_object_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member object (a data member) then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the argument in this case is a pointer to a member function and not a + member object, see <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link> + and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_member_pointer"> + <title><link linkend="boost_typetraits.reference.is_member_pointer"> is_member_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer to a member (either a function or a data member) then inherits from + <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_object"> + <title><link linkend="boost_typetraits.reference.is_object"> is_object</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_object</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + object type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + All types are object types except references, void, and function types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_object</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">&>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: reference types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>: function types are not + objects + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + void is not an object type + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pod"> + <title><link linkend="boost_typetraits.reference.is_pod"> is_pod</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pod</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + POD type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + POD stands for "Plain old data". Arithmetic types, and enumeration + types, a pointers and pointer to members are all PODs. Classes and unions + can also be POD's if they have no non-static data members that are of reference + or non-POD type, no user defined constructors, no user defined assignment + operators, no private or protected non-static data members, no virtual functions + and no base classes. Finally, a cv-qualified POD is still a POD, as is an + array of PODs. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10 and 9p4 (Note + that POD's are also aggregates, see 8.5.1). + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is<emphasis role="underline">pod + will never report that a class or struct is a POD; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler-</emphasis>_intrinsics. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_pointer"> + <title><link linkend="boost_typetraits.reference.is_pointer"> is_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + pointer type (includes function pointers, but excludes pointers to members) + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p2 and 8.3.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + <important> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> detects "real" + pointer types only, and <emphasis>not</emphasis> smart pointers. Users + should not specialise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> + for smart pointer types, as doing so may cause Boost (and other third party) + code to fail to function correctly. Users wanting a trait to detect smart + pointers should create their own. However, note that there is no way in + general to auto-magically detect smart pointer types, so such a trait would + have to be partially specialised for each supported smart pointer type. + </para> + </important> + </section> + <section id="boost_typetraits.reference.is_polymorphic"> + <title><link linkend="boost_typetraits.reference.is_polymorphic"> is_polymorphic</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_polymorphic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + polymorphic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete + type. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> The implementation + requires some knowledge of the compilers ABI, it does actually seem to work + with the majority of compilers though. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_polymorphic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">poly</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">poly</phrase><phrase role="special">();</phrase> <phrase role="special">};</phrase></computeroutput> + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">poly</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_same"> + <title><link linkend="boost_typetraits.reference.is_same"> is_same</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_same</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T and U are the same types + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_same</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with abstract, incomplete or function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&,</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_scalar"> + <title><link linkend="boost_typetraits.reference.is_scalar"> is_scalar</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_scalar</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + scalar type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Scalar types include integral, floating point, enumeration, pointer, and + pointer-to-member types. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_scalar</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_signed"> + <title><link linkend="boost_typetraits.reference.is_signed"> is_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_signed</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an signed integer type + or an enumerated type with an underlying signed integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_stateless"> + <title><link linkend="boost_typetraits.reference.is_stateless"> is_stateless</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_stateless</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Ff T is a stateless type then + inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + Type T must be a complete type. + </para> + <para> + A stateless type is a type that has no storage and whose constructors and + destructors are trivial. That means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_stateless</phrase></computeroutput> + only inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> + if the following expression is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">true</phrase></computeroutput>: + </para> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_class</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +<phrase role="special">&&</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_empty</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase> +</programlisting> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_stateless</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + can not be used with function types. + </para> + <para> + Without some (as yet unspecified) help from the compiler, is_stateless will + never report that a class or struct is stateless; this is always safe, if + possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this template work automatically. + </para> + </section> + <section id="boost_typetraits.reference.is_reference"> + <title><link linkend="boost_typetraits.reference.is_reference"> is_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_reference</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a reference pointer type + then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial-specialization of class templates, then this template + may report the wrong result for function types, and for types that are both + const and volatile qualified. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="special">(&)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis> (the argument in this case + is a reference to a function). + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_union"> + <title><link linkend="boost_typetraits.reference.is_union"> is_union</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_union</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + union type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + Currently requires some kind of compiler support, otherwise unions are identified + as classes. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.5. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as + yet unspecified) help from the compiler, we cannot distinguish between union + and class types using only standard C++, as a result this type will never + inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + unless the user explicitly specializes the template for their user-defined + union types, or unless the compiler supplies some unspecified intrinsic that + implements this functionality. Currently (May 2005) only Visual C++ 8 has + the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link> + to make this trait "just work" without user intervention. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_unsigned"> + <title><link linkend="boost_typetraits.reference.is_unsigned"> is_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_unsigned</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is an unsigned integer type + or an enumerated type with an underlying unsigned integer type, then inherits + from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">myclass</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">char</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_void"> + <title><link linkend="boost_typetraits.reference.is_void"> is_void</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_void</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified) + void type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p9. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_void</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="keyword">void</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>false</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.is_volatile"> + <title><link linkend="boost_typetraits.reference.is_volatile"> is_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">is_volatile</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> If T is a (top level) volatile-qualified + type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>, + otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">volatile</phrase> <phrase role="keyword">int</phrase><phrase role="special">></phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase> + <phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>true</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>false</emphasis>: + the volatile qualifier is not at the top level in this case. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.make_signed"> + <title><link linkend="boost_typetraits.reference.make_signed"> make_signed</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_signed</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a signed integer type then + the same type as T, if T is an unsigned integer type then the corresponding + signed type. Otherwise if T is an enumerated or character type (char or wchar_t) + then a signed integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">long</phrase> + <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + A signed integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.make_unsigned"> + <title><link linkend="boost_typetraits.reference.make_unsigned"> make_unsigned</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">make_unsigned</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If T is a unsigned integer type then + the same type as T, if T is an signed integer type then the corresponding + unsigned type. Otherwise if T is an enumerated or character type (char or + wchar_t) then an unsigned integer type with the same width as T. + </para> + <para> + If T has any cv-qualifiers then these are also present on the result type. + </para> + <para> + <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated + type, and must not be the type bool. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase> + <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase> + <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as the enum. + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special"><</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + An unsigned integer type with the same width as wchar_t. + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.promote"> + <title><link linkend="boost_typetraits.reference.promote"> promote</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">promote</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If integral or floating point promotion + can be applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + then applies integral and floating point promotions to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + See also <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link> + and <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link>. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3 + (integral bit-field) and 4.6. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">promote</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">float</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special"><</phrase><phrase role="keyword">short</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.rank"> + <title><link linkend="boost_typetraits.reference.rank"> rank</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">rank</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase> <phrase role="special">{};</phrase> +</programlisting> + <para> + <emphasis role="bold">Inherits:</emphasis> Class template rank inherits from + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)></phrase></computeroutput>, + where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is the + number of array dimensions in type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>. + </para> + <para> + If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type, + then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is zero. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">rank</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <para> + <emphasis role="bold">Examples:</emphasis> + </para> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[]></phrase></computeroutput> + inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">></phrase></computeroutput>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> + is an integral constant expression that evaluates to <emphasis>1</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>2</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression + that evaluates to <emphasis>0</emphasis>. + </para> + </para> + </blockquote> + <blockquote> + <para> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">>::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>. + </para> + </para> + </blockquote> + </section> + <section id="boost_typetraits.reference.remove_all_extents"> + <title><link linkend="boost_typetraits.reference.remove_all_extents"> remove_all_extents</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_all_extents</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes all of the array bounds on <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_all_extents</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_const"> + <title><link linkend="boost_typetraits.reference.remove_const"> remove_const</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> const-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_cv"> + <title><link linkend="boost_typetraits.reference.remove_cv"> remove_cv</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_cv</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> cv-qualifiers removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_extent"> + <title><link linkend="boost_typetraits.reference.remove_extent"> remove_extent</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_extent</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + is an array type, then removes the topmost array bound, otherwise leaves + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_pointer"> + <title><link linkend="boost_typetraits.reference.remove_pointer"> remove_pointer</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_pointer</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any pointer modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">**>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_reference"> + <title><link linkend="boost_typetraits.reference.remove_reference"> remove_reference</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_reference</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any reference modifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">*&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.remove_volatile"> + <title><link linkend="boost_typetraits.reference.remove_volatile"> remove_volatile</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">remove_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, + but with any <emphasis>top level</emphasis> volatile-qualifier removed. + </para> + <para> + <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3. + </para> + <para> + <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler + does not support partial specialization of class-templates then this template + will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput> + will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> + except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler + workarounds</link> have been applied. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + <table frame="all"> <title>Examples</title> + <tgroup cols="2"> + <thead> + <row> + <entry> + <para> + Expression + </para> + </entry><entry> + <para> + Result Type + </para> + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> + <phrase role="keyword">volatile</phrase><phrase role="special">>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase></computeroutput> + </para> + </entry> + </row> + <row> + <entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special"><</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*>::</phrase><phrase role="identifier">type</phrase></computeroutput> + </para> + </entry><entry> + <para> + <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput> + </para> + </entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id="boost_typetraits.reference.type_with_alignment"> + <title><link linkend="boost_typetraits.reference.type_with_alignment"> type_with_alignment</link></title> + +<programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">type_with_alignment</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <para> + <emphasis role="bold">type:</emphasis> a built-in or POD type with an alignment + that is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>. + </para> + <para> + <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> + <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">type_with_alignment</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase></computeroutput> + </para> + </section> + </section> + <section id="boost_typetraits.credits"> + <title><link linkend="boost_typetraits.credits"> Credits</link></title> + <para> + This documentation was pulled together by John Maddock, using <ulink url="../../../../doc/html/quickbook.html">Boost.Quickbook</ulink> + and <ulink url="../../../../doc/html/boostbook.html">Boost.DocBook</ulink>. + </para> + <para> + The original version of this library was created by Steve Cleary, Beman Dawes, + Howard Hinnant, and John Maddock. John Maddock is the current maintainer of + the library. + </para> + <para> + This version of type traits library is based on contributions by Adobe Systems + Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, + Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert + Ramey and Jeremy Siek. + </para> + <para> + Mat Marcus and Jesse Jones invented, and <ulink url="http://opensource.adobe.com/project4/project.shtml">published + a paper describing</ulink>, the partial specialization workarounds used in + this library. + </para> + <para> + Aleksey Gurtovoy added MPL integration to the library. + </para> + <para> + The <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link> + template is based on code originally devised by Andrei Alexandrescu, see "<ulink url="http://www.cuj.com/experts/1810/alexandr.htm?topic=experts">Generic<Programming>: + Mappings between Types and Values</ulink>". + </para> + <para> + The latest version of this library and documentation can be found at <ulink url="http://www.boost.org">www.boost.org</ulink>. Bugs, suggestions and discussion + should be directed to boost@lists.boost.org (see <ulink url="http://www.boost.org/more/mailing_lists.htm#main">www.boost.org/more/mailing_lists.htm#main</ulink> + for subscription details). + </para> + </section> + + <section id="boost_typetraits.ignored_section"> + <title>This section must not be indexed.</title> + <?BoostAutoIndex IgnoreSection?> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + <section id="boost_typetraits.ignored_block"> + <title>This section contains one block that must not be indexed and one that should be.</title> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + <?BoostAutoIndex IgnoreBlock?> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword"> + template</phrase> <phrase role="special"><</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">></phrase> +<phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase> +<phrase role="special">{</phrase> + <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> +<phrase role="special">};</phrase> +</programlisting> + </section> + + <para> + <index type="class_name"> + <title>Class Index</title> + </index> + <index type="typedef_name"> + <title>Typedef Index</title> + </index> + <index type="macro_name"> + <title>Macro Index</title> + </index> + <index type="test_index_1"> + <title>Index Test 1</title> + </index> + <index type="test_index_2"> + <title>Index Test 2</title> + </index> + <index/> + </para> +</chapter> + |