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