From dcee03611b4fee7cb64da00bac562651e241bebd Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 4 Oct 2007 09:18:16 +0000 Subject: [PATCH] Added tip to function_traits.qbk, rebuilt docs. [SVN r39682] --- doc/Jamfile.v2 | 3 +- doc/function_traits.qbk | 6 ++ doc/html/boost_typetraits/background.html | 22 ++--- .../boost_typetraits/category/transform.html | 2 +- doc/html/boost_typetraits/intrinsics.html | 2 +- .../boost_typetraits/reference/add_const.html | 2 +- .../boost_typetraits/reference/add_cv.html | 2 +- .../reference/add_pointer.html | 2 +- .../reference/add_reference.html | 2 +- .../reference/add_volatile.html | 2 +- .../boost_typetraits/reference/decay.html | 2 +- .../reference/floating_point_promotion.html | 2 +- .../reference/function_traits.html | 15 +++- .../reference/integral_promotion.html | 2 +- .../reference/is_function.html | 81 +++++++------------ .../reference/is_pointer.html | 27 +++---- .../reference/make_signed.html | 2 +- .../reference/make_unsigned.html | 2 +- .../boost_typetraits/reference/promote.html | 2 +- .../reference/remove_all_extents.html | 2 +- .../reference/remove_const.html | 2 +- .../boost_typetraits/reference/remove_cv.html | 2 +- .../reference/remove_extent.html | 2 +- .../reference/remove_pointer.html | 2 +- .../reference/remove_reference.html | 2 +- .../reference/remove_volatile.html | 2 +- doc/html/index.html | 2 +- 27 files changed, 91 insertions(+), 105 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index a642ebe..6926164 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -11,7 +11,7 @@ boostbook standalone type_traits : # Path for links to Boost: - boost.root=../../../../ + boost.root=../../../.. # Path for libraries index: boost.libraries=../../../libraries.htm # Use the main Boost stylesheet: @@ -60,3 +60,4 @@ boostbook standalone #install html : ../../../doc/html/boostbook.css ; #install ../ : ../../../boost.png ; + diff --git a/doc/function_traits.qbk b/doc/function_traits.qbk index ecf220e..366d66d 100644 --- a/doc/function_traits.qbk +++ b/doc/function_traits.qbk @@ -15,6 +15,12 @@ The class template function_traits will only compile if: * The template argument `T` is a /function type/, note that this ['[*is not]] the same thing as a /pointer to a function/. +[tip +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 __remove_pointer.] + [table Function Traits Members [[Member] [Description]] [[`function_traits::arity`] diff --git a/doc/html/boost_typetraits/background.html b/doc/html/boost_typetraits/background.html index 762b544..2936f47 100644 --- a/doc/html/boost_typetraits/background.html +++ b/doc/html/boost_typetraits/background.html @@ -56,7 +56,7 @@ method available to them.

- + Type Traits

@@ -84,7 +84,7 @@ given.

- + Implementation

@@ -179,7 +179,7 @@ in the default template.

- + Optimized copy

@@ -253,7 +253,7 @@ otherwise it will call the "slow but safe version".

- + Was it worth it?

@@ -286,7 +286,7 @@

-

Table 1.1. Time taken to copy 1000 elements using `copy<const +

Table 1.1. Time taken to copy 1000 elements using `copy<const T*, T*>` (times in micro-seconds)

@@ -385,7 +385,7 @@

- + Pair of References

@@ -423,7 +423,7 @@ to hold non-reference types, references, and constant references:

-

Table 1.2. Required Constructor Argument Types

+

Table 1.2. Required Constructor Argument Types

@@ -488,7 +488,7 @@ adds a reference to its type, unless it is already a reference.

-

Table 1.3. Using add_reference to synthesize the correct constructor +

Table 1.3. Using add_reference to synthesize the correct constructor type

@@ -606,7 +606,7 @@ easier to maintain and easier to understand.

- + Conclusion

@@ -619,7 +619,7 @@ can be optimal as well as generic.

- + Acknowledgements

@@ -627,7 +627,7 @@ comments when preparing this article.

- + References
    diff --git a/doc/html/boost_typetraits/category/transform.html b/doc/html/boost_typetraits/category/transform.html index e7095bb..0e9dbcb 100644 --- a/doc/html/boost_typetraits/category/transform.html +++ b/doc/html/boost_typetraits/category/transform.html @@ -92,7 +92,7 @@ struct remove_volatile;
    - + Broken Compiler Workarounds:
    diff --git a/doc/html/boost_typetraits/intrinsics.html b/doc/html/boost_typetraits/intrinsics.html index 2935470..1f21924 100644 --- a/doc/html/boost_typetraits/intrinsics.html +++ b/doc/html/boost_typetraits/intrinsics.html @@ -71,7 +71,7 @@ of the following macros:

    -

    Table 1.4. Macros for Compiler Intrinsics

    +

    Table 1.4. Macros for Compiler Intrinsics

diff --git a/doc/html/boost_typetraits/reference/add_const.html b/doc/html/boost_typetraits/reference/add_const.html index 2a2c437..6edf188 100644 --- a/doc/html/boost_typetraits/reference/add_const.html +++ b/doc/html/boost_typetraits/reference/add_const.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.5. Examples

+

Table 1.5. Examples

diff --git a/doc/html/boost_typetraits/reference/add_cv.html b/doc/html/boost_typetraits/reference/add_cv.html index 44a0fb4..9eb7c37 100644 --- a/doc/html/boost_typetraits/reference/add_cv.html +++ b/doc/html/boost_typetraits/reference/add_cv.html @@ -55,7 +55,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.6. Examples

+

Table 1.6. Examples

diff --git a/doc/html/boost_typetraits/reference/add_pointer.html b/doc/html/boost_typetraits/reference/add_pointer.html index c69c8e6..fac8b58 100644 --- a/doc/html/boost_typetraits/reference/add_pointer.html +++ b/doc/html/boost_typetraits/reference/add_pointer.html @@ -57,7 +57,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.7. Examples

+

Table 1.7. Examples

diff --git a/doc/html/boost_typetraits/reference/add_reference.html b/doc/html/boost_typetraits/reference/add_reference.html index 5e96e6a..3a99d5b 100644 --- a/doc/html/boost_typetraits/reference/add_reference.html +++ b/doc/html/boost_typetraits/reference/add_reference.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.8. Examples

+

Table 1.8. Examples

diff --git a/doc/html/boost_typetraits/reference/add_volatile.html b/doc/html/boost_typetraits/reference/add_volatile.html index 17e8fc7..0806c65 100644 --- a/doc/html/boost_typetraits/reference/add_volatile.html +++ b/doc/html/boost_typetraits/reference/add_volatile.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.9. Examples

+

Table 1.9. Examples

diff --git a/doc/html/boost_typetraits/reference/decay.html b/doc/html/boost_typetraits/reference/decay.html index 4887e29..25a099a 100644 --- a/doc/html/boost_typetraits/reference/decay.html +++ b/doc/html/boost_typetraits/reference/decay.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.10. Examples

+

Table 1.10. Examples

diff --git a/doc/html/boost_typetraits/reference/floating_point_promotion.html b/doc/html/boost_typetraits/reference/floating_point_promotion.html index f0817f1..9f7cfc7 100644 --- a/doc/html/boost_typetraits/reference/floating_point_promotion.html +++ b/doc/html/boost_typetraits/reference/floating_point_promotion.html @@ -50,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.11. Examples

+

Table 1.11. Examples

diff --git a/doc/html/boost_typetraits/reference/function_traits.html b/doc/html/boost_typetraits/reference/function_traits.html index 5b30ef0..cffc73d 100644 --- a/doc/html/boost_typetraits/reference/function_traits.html +++ b/doc/html/boost_typetraits/reference/function_traits.html @@ -48,8 +48,19 @@ to a function. +
+ + + + + +
[Tip]Tip

+ 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 remove_pointer. +

-

Table 1.12. Function Traits Members

+

Table 1.12. Function Traits Members

@@ -112,7 +123,7 @@

-

Table 1.13. Examples

+

Table 1.13. Examples

diff --git a/doc/html/boost_typetraits/reference/integral_promotion.html b/doc/html/boost_typetraits/reference/integral_promotion.html index fe27f79..b1ee9fc 100644 --- a/doc/html/boost_typetraits/reference/integral_promotion.html +++ b/doc/html/boost_typetraits/reference/integral_promotion.html @@ -50,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.14. Examples

+

Table 1.14. Examples

diff --git a/doc/html/boost_typetraits/reference/is_function.html b/doc/html/boost_typetraits/reference/is_function.html index 5a1e59a..a70206b 100644 --- a/doc/html/boost_typetraits/reference/is_function.html +++ b/doc/html/boost_typetraits/reference/is_function.html @@ -131,69 +131,44 @@

-

+ Don't confuse function-types with pointers to functions: +

- Don't confuse function-types with pointers to functions: -

+ typedef int + f(double); +

-

+ defines a function type, +

- typedef int - f(double); -

+ f foo; +

-

+ declares a prototype for a function of type f, +

- defines a function type, -

+ f* + pf = + foo; +

-

+ f& + fr = + foo; +

- f foo; -

+ declares a pointer and a reference to the function foo. +

-

+ If you want to detect whether some type is a pointer-to-function then use: +

- declares a prototype for a function of type f, -

-

-

-

- f* - pf = - foo; -

-

-

-

- f& - fr = - foo; -

-

-

-

- declares a pointer and a reference to the function foo. -

-

-

-

- If you want to detect whether some type is a pointer-to-function then - use: -

-

-

-

- is_function<remove_pointer<T>::type>::value - && is_pointer<T>::value -

-

-

-

- or for pointers to member functions you can just use is_member_function_pointer - directly. -

+ is_function<remove_pointer<T>::type>::value + && is_pointer<T>::value +

+ or for pointers to member functions you can just use is_member_function_pointer + directly.

diff --git a/doc/html/boost_typetraits/reference/is_pointer.html b/doc/html/boost_typetraits/reference/is_pointer.html index 5a1c6f6..1f955be 100644 --- a/doc/html/boost_typetraits/reference/is_pointer.html +++ b/doc/html/boost_typetraits/reference/is_pointer.html @@ -110,23 +110,16 @@ [Important] Important - -

-

-

- is_pointer detects "real" - pointer types only, and not smart pointers. Users - should not specialise is_pointer - 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. -

-

-

- +

+ is_pointer detects "real" + pointer types only, and not smart pointers. Users + should not specialise is_pointer + 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. +

diff --git a/doc/html/boost_typetraits/reference/make_signed.html b/doc/html/boost_typetraits/reference/make_signed.html index 5bd6469..bbf824e 100644 --- a/doc/html/boost_typetraits/reference/make_signed.html +++ b/doc/html/boost_typetraits/reference/make_signed.html @@ -55,7 +55,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.15. Examples

+

Table 1.15. Examples

diff --git a/doc/html/boost_typetraits/reference/make_unsigned.html b/doc/html/boost_typetraits/reference/make_unsigned.html index a42cab5..b77a4d5 100644 --- a/doc/html/boost_typetraits/reference/make_unsigned.html +++ b/doc/html/boost_typetraits/reference/make_unsigned.html @@ -55,7 +55,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.16. Examples

+

Table 1.16. Examples

diff --git a/doc/html/boost_typetraits/reference/promote.html b/doc/html/boost_typetraits/reference/promote.html index 048075e..cb3bf1f 100644 --- a/doc/html/boost_typetraits/reference/promote.html +++ b/doc/html/boost_typetraits/reference/promote.html @@ -52,7 +52,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.17. Examples

+

Table 1.17. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_all_extents.html b/doc/html/boost_typetraits/reference/remove_all_extents.html index c3c734f..b7b23d5 100644 --- a/doc/html/boost_typetraits/reference/remove_all_extents.html +++ b/doc/html/boost_typetraits/reference/remove_all_extents.html @@ -55,7 +55,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.18. Examples

+

Table 1.18. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_const.html b/doc/html/boost_typetraits/reference/remove_const.html index 983d8c4..26e6421 100644 --- a/doc/html/boost_typetraits/reference/remove_const.html +++ b/doc/html/boost_typetraits/reference/remove_const.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.19. Examples

+

Table 1.19. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_cv.html b/doc/html/boost_typetraits/reference/remove_cv.html index 9b25477..290a560 100644 --- a/doc/html/boost_typetraits/reference/remove_cv.html +++ b/doc/html/boost_typetraits/reference/remove_cv.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.20. Examples

+

Table 1.20. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_extent.html b/doc/html/boost_typetraits/reference/remove_extent.html index 48dcb37..24aa231 100644 --- a/doc/html/boost_typetraits/reference/remove_extent.html +++ b/doc/html/boost_typetraits/reference/remove_extent.html @@ -55,7 +55,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.21. Examples

+

Table 1.21. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_pointer.html b/doc/html/boost_typetraits/reference/remove_pointer.html index 107d1a9..ff55dd6 100644 --- a/doc/html/boost_typetraits/reference/remove_pointer.html +++ b/doc/html/boost_typetraits/reference/remove_pointer.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.22. Examples

+

Table 1.22. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_reference.html b/doc/html/boost_typetraits/reference/remove_reference.html index d90e787..d247cf5 100644 --- a/doc/html/boost_typetraits/reference/remove_reference.html +++ b/doc/html/boost_typetraits/reference/remove_reference.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.23. Examples

+

Table 1.23. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_volatile.html b/doc/html/boost_typetraits/reference/remove_volatile.html index 3c76cd1..50ba5ec 100644 --- a/doc/html/boost_typetraits/reference/remove_volatile.html +++ b/doc/html/boost_typetraits/reference/remove_volatile.html @@ -54,7 +54,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.24. Examples

+

Table 1.24. Examples

diff --git a/doc/html/index.html b/doc/html/index.html index de9bb82..e8c88d1 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -27,7 +27,7 @@ Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert Ramey and Jeremy Siek

-

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.orgLICENSE_1_0.txt"> http:/www.boost.org/LICENSE_1_0.txt </ulink>)