diff --git a/doc/has_new_operator.qbk b/doc/has_new_operator.qbk new file mode 100644 index 0000000..72e0d4c --- /dev/null +++ b/doc/has_new_operator.qbk @@ -0,0 +1,49 @@ +[/ + Copyright 2009 John Maddock. + 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). +] + +[section:has_new_operator has_new_operator] + template + struct has_new_operator : public __tof {}; + +__inherit If T is a (possibly cv-qualified) type with an overloaded new-operator +then inherits from __true_type, otherwise inherits from __false_type. + +__compat Not usable with compilers that do not support "substitution failure is not an error" +(in which case BOOST_NO_SFINAE will be defined), also known to be broken with +the Borland/Codegear compiler. + +__std_ref 12.5. + +__header ` #include ` or ` #include ` + +__examples + +Given: + + class A { void* operator new(std::size_t); }; + class B { void* operator new(std::size_t, const std::nothrow&); }; + class C { void* operator new(std::size_t, void*); }; + class D { void* operator new[](std::size_t); }; + class E { void* operator new[](std::size_t, const std::nothrow&); }; + class F { void* operator new[](std::size_t, void*); }; + +Then: + +[:`has_new_operator` inherits from `__true_type`.] + +[:`has_new_operator` inherits from `__true_type`.] + +[:`has_new_operator` inherits from `__true_type`.] + +[:`has_new_operator` inherits from `__true_type`.] + +[:`has_new_operator` inherits from `__true_type`.] + +[:`has_new_operator` inherits from `__true_type`.] + +[endsect] + diff --git a/doc/html/boost_typetraits/background.html b/doc/html/boost_typetraits/background.html index 9f5e61f..b18d244 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

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

- + Optimized copy

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

- + Was it worth it?

@@ -280,7 +280,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)

@@ -379,7 +379,7 @@

- + Pair of References

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

-

Table 1.2. Required Constructor Argument Types

+

Table 1.2. Required Constructor Argument Types

@@ -481,7 +481,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

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

- + Conclusion

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

- + Acknowledgements

@@ -619,7 +619,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 01b677b..9da2050 100644 --- a/doc/html/boost_typetraits/category/transform.html +++ b/doc/html/boost_typetraits/category/transform.html @@ -91,7 +91,7 @@ struct remove_volatile;
    - + Broken Compiler Workarounds:
    diff --git a/doc/html/boost_typetraits/category/value_traits/properties.html b/doc/html/boost_typetraits/category/value_traits/properties.html index 31761d3..c542c7b 100644 --- a/doc/html/boost_typetraits/category/value_traits/properties.html +++ b/doc/html/boost_typetraits/category/value_traits/properties.html @@ -36,6 +36,9 @@
    template <class T>
     struct alignment_of;
     
    +template <class T>
    +struct has_new_operator;
    +
     template <class T>
     struct has_nothrow_assign;
     
    diff --git a/doc/html/boost_typetraits/category/value_traits/relate.html b/doc/html/boost_typetraits/category/value_traits/relate.html
    index 5975a0e..b51ce35 100644
    --- a/doc/html/boost_typetraits/category/value_traits/relate.html
    +++ b/doc/html/boost_typetraits/category/value_traits/relate.html
    @@ -37,6 +37,9 @@
     
    template <class Base, class Derived>
     struct is_base_of;
     
    +template <class Base, class Derived>
    +struct is_virtual_base_of;
    +
     template <class From, class To>
     struct is_convertible;
     
    diff --git a/doc/html/boost_typetraits/intrinsics.html b/doc/html/boost_typetraits/intrinsics.html
    index e81984e..ccbf12e 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.html b/doc/html/boost_typetraits/reference.html index bb362a2..b2c2e5a 100644 --- a/doc/html/boost_typetraits/reference.html +++ b/doc/html/boost_typetraits/reference.html @@ -39,6 +39,7 @@
floating_point_promotion
function_traits
+
has_new_operator
has_nothrow_assign
has_nothrow_constructor
@@ -86,6 +87,7 @@
is_reference
is_union
is_unsigned
+
is_virtual_base_of
is_void
is_volatile
make_signed
diff --git a/doc/html/boost_typetraits/reference/add_const.html b/doc/html/boost_typetraits/reference/add_const.html index 4164c1c..c14f17f 100644 --- a/doc/html/boost_typetraits/reference/add_const.html +++ b/doc/html/boost_typetraits/reference/add_const.html @@ -53,7 +53,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 aded111..e9312c7 100644 --- a/doc/html/boost_typetraits/reference/add_cv.html +++ b/doc/html/boost_typetraits/reference/add_cv.html @@ -54,7 +54,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 4d1f84c..c8e7569 100644 --- a/doc/html/boost_typetraits/reference/add_pointer.html +++ b/doc/html/boost_typetraits/reference/add_pointer.html @@ -56,7 +56,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 621e022..39e4c2c 100644 --- a/doc/html/boost_typetraits/reference/add_reference.html +++ b/doc/html/boost_typetraits/reference/add_reference.html @@ -53,7 +53,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 449f3d4..20062c0 100644 --- a/doc/html/boost_typetraits/reference/add_volatile.html +++ b/doc/html/boost_typetraits/reference/add_volatile.html @@ -53,7 +53,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 088b574..6e4af7b 100644 --- a/doc/html/boost_typetraits/reference/decay.html +++ b/doc/html/boost_typetraits/reference/decay.html @@ -48,7 +48,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 75aeb25..d63eadd 100644 --- a/doc/html/boost_typetraits/reference/floating_point_promotion.html +++ b/doc/html/boost_typetraits/reference/floating_point_promotion.html @@ -49,7 +49,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 66f56c0..9bf4a8a 100644 --- a/doc/html/boost_typetraits/reference/function_traits.html +++ b/doc/html/boost_typetraits/reference/function_traits.html @@ -7,7 +7,7 @@ - +
@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -59,7 +59,7 @@

-

Table 1.12. Function Traits Members

+

Table 1.12. Function Traits Members

@@ -122,7 +122,7 @@

-

Table 1.13. Examples

+

Table 1.13. Examples

@@ -269,7 +269,7 @@

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/has_new_operator.html b/doc/html/boost_typetraits/reference/has_new_operator.html new file mode 100644 index 0000000..ff41e85 --- /dev/null +++ b/doc/html/boost_typetraits/reference/has_new_operator.html @@ -0,0 +1,144 @@ + + + +has_new_operator + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
template <class T>
+struct has_new_operator : public true_type-or-false_type {};
+
+

+ Inherits: If T is a (possibly cv-qualified) + type with an overloaded new-operator then inherits from true_type, + otherwise inherits from false_type. +

+

+ Compiler Compatibility: Not usable with + compilers that do not support "substitution failure is not an error" + (in which case BOOST_NO_SFINAE will be defined), also known to be broken + with the Borland/Codegear compiler. +

+

+ C++ Standard Reference: 12.5. +

+

+ Header: #include + <boost/type_traits/has_new_operator.hpp> + or #include <boost/type_traits.hpp> +

+

+ Examples: +

+

+ Given: +

+
class A { void* operator new(std::size_t); };
+class B { void* operator new(std::size_t, const std::nothrow&); };
+class C { void* operator new(std::size_t, void*); };
+class D { void* operator new[](std::size_t); };
+class E { void* operator new[](std::size_t, const std::nothrow&); };
+class F { void* operator new[](std::size_t, void*); };
+
+

+ Then: +

+
+

+

+

+ has_new_operator<A> + inherits from true_type. +

+

+

+
+
+

+

+

+ has_new_operator<B> + inherits from true_type. +

+

+

+
+
+

+

+

+ has_new_operator<C> + inherits from true_type. +

+

+

+
+
+

+

+

+ has_new_operator<D> + inherits from true_type. +

+

+

+
+
+

+

+

+ has_new_operator<E> + inherits from true_type. +

+

+

+
+
+

+

+

+ has_new_operator<F> + inherits from true_type. +

+

+

+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_typetraits/reference/has_nothrow_assign.html b/doc/html/boost_typetraits/reference/has_nothrow_assign.html index eb3320d..43f99e3 100644 --- a/doc/html/boost_typetraits/reference/has_nothrow_assign.html +++ b/doc/html/boost_typetraits/reference/has_nothrow_assign.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -67,7 +67,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/integral_promotion.html b/doc/html/boost_typetraits/reference/integral_promotion.html index a0acd07..79b92c1 100644 --- a/doc/html/boost_typetraits/reference/integral_promotion.html +++ b/doc/html/boost_typetraits/reference/integral_promotion.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.14. Examples

+

Table 1.14. Examples

diff --git a/doc/html/boost_typetraits/reference/is_unsigned.html b/doc/html/boost_typetraits/reference/is_unsigned.html index 4b65cc8..362dfd5 100644 --- a/doc/html/boost_typetraits/reference/is_unsigned.html +++ b/doc/html/boost_typetraits/reference/is_unsigned.html @@ -7,7 +7,7 @@ - +
@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -130,7 +130,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_virtual_base_of.html b/doc/html/boost_typetraits/reference/is_virtual_base_of.html new file mode 100644 index 0000000..6a0678b --- /dev/null +++ b/doc/html/boost_typetraits/reference/is_virtual_base_of.html @@ -0,0 +1,132 @@ + + + +is_virtual_base_of + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
template <class Base, class Derived>
+struct is_virtual_base_of : public true_type-or-false_type {};
+
+

+ Inherits: If Base is a virtual base class + of type Derived then inherits from true_type, + otherwise inherits from false_type. +

+

+ Types Base and Derived must not be incomplete types. +

+

+ C++ Standard Reference: 10. +

+

+ Header: #include + <boost/type_traits/is_virtual_base_of.hpp> + or #include <boost/type_traits.hpp> +

+

+ Compiler Compatibility: this trait also + requires a working is_base_of + trait. +

+

+ Examples: +

+
+

+

+

+ Given: class Base{}; class Derived : + public virtual + Base{}; +

+

+

+
+
+

+

+

+ is_virtual_base_of<Base, Derived> + inherits from true_type. +

+

+

+
+
+

+

+

+ is_virtual_base_of<Base, Derived>::type is the type true_type. +

+

+

+
+
+

+

+

+ is_virtual_base_of<Base, Derived>::value is an integral constant expression + that evaluates to true. +

+

+

+
+
+

+

+

+ is_virtual_base_of<Base, Derived>::value is an integral constant expression + that evaluates to true. +

+

+

+
+
+

+

+

+ is_virtual_base_of<T, U>::value_type is the type bool. +

+

+

+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_typetraits/reference/is_void.html b/doc/html/boost_typetraits/reference/is_void.html index 74b28fc..78bbb8b 100644 --- a/doc/html/boost_typetraits/reference/is_void.html +++ b/doc/html/boost_typetraits/reference/is_void.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -108,7 +108,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/make_signed.html b/doc/html/boost_typetraits/reference/make_signed.html index 4e37228..c4ef33f 100644 --- a/doc/html/boost_typetraits/reference/make_signed.html +++ b/doc/html/boost_typetraits/reference/make_signed.html @@ -54,7 +54,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 76386a0..452ad8f 100644 --- a/doc/html/boost_typetraits/reference/make_unsigned.html +++ b/doc/html/boost_typetraits/reference/make_unsigned.html @@ -54,7 +54,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 1f648d9..7498f31 100644 --- a/doc/html/boost_typetraits/reference/promote.html +++ b/doc/html/boost_typetraits/reference/promote.html @@ -51,7 +51,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 b8d5c4c..4e67ce9 100644 --- a/doc/html/boost_typetraits/reference/remove_all_extents.html +++ b/doc/html/boost_typetraits/reference/remove_all_extents.html @@ -54,7 +54,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 cc30157..b10ae71 100644 --- a/doc/html/boost_typetraits/reference/remove_const.html +++ b/doc/html/boost_typetraits/reference/remove_const.html @@ -53,7 +53,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 2f8b2be..7aad042 100644 --- a/doc/html/boost_typetraits/reference/remove_cv.html +++ b/doc/html/boost_typetraits/reference/remove_cv.html @@ -53,7 +53,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 cb28caa..c7262c1 100644 --- a/doc/html/boost_typetraits/reference/remove_extent.html +++ b/doc/html/boost_typetraits/reference/remove_extent.html @@ -54,7 +54,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 09a8a02..c761454 100644 --- a/doc/html/boost_typetraits/reference/remove_pointer.html +++ b/doc/html/boost_typetraits/reference/remove_pointer.html @@ -53,7 +53,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 03c9472..9da586a 100644 --- a/doc/html/boost_typetraits/reference/remove_reference.html +++ b/doc/html/boost_typetraits/reference/remove_reference.html @@ -53,7 +53,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 947a9d7..b154050 100644 --- a/doc/html/boost_typetraits/reference/remove_volatile.html +++ b/doc/html/boost_typetraits/reference/remove_volatile.html @@ -53,7 +53,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 c81c06b..41a96b4 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -30,7 +30,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 http://www.boost.org/LICENSE_1_0.txt)

@@ -90,6 +90,7 @@
floating_point_promotion
function_traits
+
has_new_operator
has_nothrow_assign
has_nothrow_constructor
@@ -137,6 +138,7 @@
is_reference
is_union
is_unsigned
+
is_virtual_base_of
is_void
is_volatile
make_signed
diff --git a/doc/is_virtual_base_of.qbk b/doc/is_virtual_base_of.qbk new file mode 100644 index 0000000..72cf23a --- /dev/null +++ b/doc/is_virtual_base_of.qbk @@ -0,0 +1,40 @@ +[/ + Copyright 2009 John Maddock. + 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). +] + +[section:is_virtual_base_of is_virtual_base_of] + template + struct is_virtual_base_of : public __tof {}; + +__inherit If Base is a virtual base class of type Derived then inherits from __true_type, +otherwise inherits from __false_type. + +Types `Base` and `Derived` must not be incomplete types. + +__std_ref 10. + +__header ` #include ` or ` #include ` + +__compat this trait also requires a working __is_base_of trait. + +__examples + +[:Given: ` class Base{}; class Derived : public virtual Base{};` ] + +[:`is_virtual_base_of` inherits from `__true_type`.] + +[:`is_virtual_base_of::type` is the type `__true_type`.] + +[:`is_virtual_base_of::value` is an integral constant +expression that evaluates to /true/.] + +[:`is_virtual_base_of::value` is an integral constant +expression that evaluates to /true/.] + +[:`is_virtual_base_of::value_type` is the type `bool`.] + +[endsect] + diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 9bf50f8..2c20b19 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -73,6 +73,7 @@ [def __has_virtual_destructor [link boost_typetraits.reference.has_virtual_destructor has_virtual_destructor]] [def __is_pod [link boost_typetraits.reference.is_pod is_pod]] [def __has_trivial_constructor [link boost_typetraits.reference.has_trivial_constructor has_trivial_constructor]] +[def __has_new_operator [link boost_typetraits.reference.has_new_operator has_new_operator]] [def __has_trivial_copy [link boost_typetraits.reference.has_trivial_copy has_trivial_copy]] [def __has_trivial_default_constructor [link boost_typetraits.reference.has_trivial_constructor has_trivial_default_constructor]] [def __has_trivial_copy_constructor [link boost_typetraits.reference.has_trivial_copy has_trivial_copy_constructor]] @@ -86,6 +87,7 @@ [def __has_nothrow_assign [link boost_typetraits.reference.has_nothrow_assign has_nothrow_assign]] [def __is_base_of [link boost_typetraits.reference.is_base_of is_base_of]] +[def __is_virtual_base_of [link boost_typetraits.reference.is_virtual_base_of is_virtual_base_of]] [def __is_convertible [link boost_typetraits.reference.is_convertible is_convertible]] [def __is_same [link boost_typetraits.reference.is_same is_same]] @@ -168,6 +170,7 @@ that is the result of the transformation. [include floating_point_promotion.qbk] [include function_traits.qbk] +[include has_new_operator.qbk] [include has_nothrow_assign.qbk] [include has_nothrow_constructor.qbk] [include has_nothrow_copy.qbk] @@ -221,6 +224,7 @@ See __has_trivial_constructor. [include is_reference.qbk] [include is_union.qbk] [include is_unsigned.qbk] +[include is_virtual_base_of.qbk] [include is_void.qbk] [include is_volatile.qbk] diff --git a/doc/value_traits.qbk b/doc/value_traits.qbk index 070f8a3..4ef1f98 100644 --- a/doc/value_traits.qbk +++ b/doc/value_traits.qbk @@ -102,6 +102,9 @@ The following templates describe the general properties of a type. template struct __alignment_of; + template + struct __has_new_operator; + template struct __has_nothrow_assign; @@ -183,6 +186,9 @@ between two types: template struct __is_base_of; + template + struct __is_virtual_base_of; + template struct __is_convertible;