annotate DEPENDENCIES/generic/include/boost/proto/detail/is_noncopyable.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 /// \file is_noncopyable.hpp
Chris@16 3 /// Utility for detecting when types are non-copyable
Chris@16 4 //
Chris@16 5 // Copyright 2008 Eric Niebler. Distributed under the Boost
Chris@16 6 // Software License, Version 1.0. (See accompanying file
Chris@16 7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8
Chris@16 9 #ifndef BOOST_PROTO_DETAIL_IS_NONCOPYABLE_HPP_EAN_19_07_2012
Chris@16 10 #define BOOST_PROTO_DETAIL_IS_NONCOPYABLE_HPP_EAN_19_07_2012
Chris@16 11
Chris@16 12 #include <boost/noncopyable.hpp>
Chris@16 13 #include <boost/mpl/or.hpp>
Chris@16 14 #include <boost/mpl/bool.hpp>
Chris@16 15 #include <boost/type_traits/is_base_of.hpp>
Chris@16 16 #include <boost/type_traits/is_abstract.hpp>
Chris@16 17 #include <boost/type_traits/is_function.hpp>
Chris@16 18 #include <boost/proto/proto_fwd.hpp>
Chris@16 19
Chris@16 20 namespace boost { namespace proto { namespace detail
Chris@16 21 {
Chris@16 22 // All classes derived from std::ios_base have these public nested types,
Chris@16 23 // and are non-copyable. This is an imperfect test, but it's the best we
Chris@16 24 // we can do.
Chris@16 25 template<typename T>
Chris@16 26 yes_type check_is_iostream(
Chris@16 27 typename T::failure *
Chris@16 28 , typename T::Init *
Chris@16 29 , typename T::fmtflags *
Chris@16 30 , typename T::iostate *
Chris@16 31 , typename T::openmode *
Chris@16 32 , typename T::seekdir *
Chris@16 33 );
Chris@16 34
Chris@16 35 template<typename T>
Chris@16 36 no_type check_is_iostream(...);
Chris@16 37
Chris@16 38 template<typename T>
Chris@16 39 struct is_iostream
Chris@16 40 {
Chris@16 41 static bool const value = sizeof(yes_type) == sizeof(check_is_iostream<T>(0,0,0,0,0,0));
Chris@16 42 typedef mpl::bool_<value> type;
Chris@16 43 };
Chris@16 44
Chris@16 45 /// INTERNAL ONLY
Chris@16 46 // This should be a customization point. And it serves the same purpose
Chris@16 47 // as the is_noncopyable trait in Boost.Foreach.
Chris@16 48 template<typename T>
Chris@16 49 struct is_noncopyable
Chris@16 50 : mpl::or_<
Chris@16 51 is_function<T>
Chris@16 52 , is_abstract<T>
Chris@16 53 , is_iostream<T>
Chris@16 54 , is_base_of<noncopyable, T>
Chris@16 55 >
Chris@16 56 {};
Chris@16 57
Chris@16 58 template<typename T, std::size_t N>
Chris@16 59 struct is_noncopyable<T[N]>
Chris@16 60 : mpl::true_
Chris@16 61 {};
Chris@16 62
Chris@16 63 }}}
Chris@16 64
Chris@16 65 #endif