has_new_operator.qbk 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. [section:has_new_operator has_new_operator]
  8. template <class T>
  9. struct has_new_operator : public __tof {};
  10. __inherit If T is a (possibly cv-qualified) type with an overloaded new-operator
  11. then inherits from __true_type, otherwise inherits from __false_type.
  12. [has_binary_operator_compat] Also known to be broken with the Borland/Codegear compilers.
  13. __std_ref 12.5.
  14. __header ` #include <boost/type_traits/has_new_operator.hpp>` or ` #include <boost/type_traits.hpp>`
  15. __examples
  16. Given:
  17. class A { void* operator new(std::size_t); };
  18. class B { void* operator new(std::size_t, const std::nothrow&); };
  19. class C { void* operator new(std::size_t, void*); };
  20. class D { void* operator new[](std::size_t); };
  21. class E { void* operator new[](std::size_t, const std::nothrow&); };
  22. class F { void* operator new[](std::size_t, void*); };
  23. Then:
  24. [:`has_new_operator<A>` inherits from `__true_type`.]
  25. [:`has_new_operator<B>` inherits from `__true_type`.]
  26. [:`has_new_operator<C>` inherits from `__true_type`.]
  27. [:`has_new_operator<D>` inherits from `__true_type`.]
  28. [:`has_new_operator<E>` inherits from `__true_type`.]
  29. [:`has_new_operator<F>` inherits from `__true_type`.]
  30. [endsect]