is_noncopyable.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef BOOST_TYPE_TRAITS_IS_NONCOPYABLE_HPP_INCLUDED
  2. #define BOOST_TYPE_TRAITS_IS_NONCOPYABLE_HPP_INCLUDED
  3. //
  4. // Copyright 2018 Peter Dimov
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. //
  10. // is_noncopyable<T> returns whether T is derived from boost::noncopyable
  11. //
  12. #include <boost/type_traits/is_base_and_derived.hpp>
  13. namespace boost
  14. {
  15. #ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
  16. #define BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
  17. // boost::noncopyable derives from noncopyable_::base_token to enable us
  18. // to recognize it. The definition is macro-guarded so that we can replicate
  19. // it here without including boost/core/noncopyable.hpp, which is in Core.
  20. namespace noncopyable_
  21. {
  22. struct base_token {};
  23. }
  24. #endif // #ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
  25. template<class T> struct is_noncopyable: is_base_and_derived<noncopyable_::base_token, T>
  26. {
  27. };
  28. } // namespace boost
  29. #endif // #ifndef BOOST_TYPE_TRAITS_IS_NONCOPYABLE_HPP_INCLUDED