]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | Copyright 2009 John Maddock. | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:has_new_operator has_new_operator] | |
9 | template <class T> | |
10 | struct has_new_operator : public __tof {}; | |
11 | ||
12 | __inherit If T is a (possibly cv-qualified) type with an overloaded new-operator | |
13 | then inherits from __true_type, otherwise inherits from __false_type. | |
14 | ||
15 | [has_binary_operator_compat] Also known to be broken with the Borland/Codegear compilers. | |
16 | ||
17 | __std_ref 12.5. | |
18 | ||
19 | __header ` #include <boost/type_traits/has_new_operator.hpp>` or ` #include <boost/type_traits.hpp>` | |
20 | ||
21 | __examples | |
22 | ||
23 | Given: | |
24 | ||
25 | class A { void* operator new(std::size_t); }; | |
26 | class B { void* operator new(std::size_t, const std::nothrow&); }; | |
27 | class C { void* operator new(std::size_t, void*); }; | |
28 | class D { void* operator new[](std::size_t); }; | |
29 | class E { void* operator new[](std::size_t, const std::nothrow&); }; | |
30 | class F { void* operator new[](std::size_t, void*); }; | |
31 | ||
32 | Then: | |
33 | ||
34 | [:`has_new_operator<A>` inherits from `__true_type`.] | |
35 | ||
36 | [:`has_new_operator<B>` inherits from `__true_type`.] | |
37 | ||
38 | [:`has_new_operator<C>` inherits from `__true_type`.] | |
39 | ||
40 | [:`has_new_operator<D>` inherits from `__true_type`.] | |
41 | ||
42 | [:`has_new_operator<E>` inherits from `__true_type`.] | |
43 | ||
44 | [:`has_new_operator<F>` inherits from `__true_type`.] | |
45 | ||
46 | [endsect] | |
47 |