1 ///////////////////////////////////////////////////////////////////////////////
2 /// \file is_noncopyable.hpp
3 /// Utility for detecting when types are non-copyable
5 // Copyright 2008 Eric Niebler. Distributed under the Boost
6 // Software License, Version 1.0. (See accompanying file
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_PROTO_DETAIL_IS_NONCOPYABLE_HPP_EAN_19_07_2012
10 #define BOOST_PROTO_DETAIL_IS_NONCOPYABLE_HPP_EAN_19_07_2012
12 #include <boost/noncopyable.hpp>
13 #include <boost/mpl/or.hpp>
14 #include <boost/mpl/bool.hpp>
15 #include <boost/type_traits/is_base_of.hpp>
16 #include <boost/type_traits/is_abstract.hpp>
17 #include <boost/type_traits/is_function.hpp>
18 #include <boost/proto/proto_fwd.hpp>
20 namespace boost { namespace proto { namespace detail
22 // All classes derived from std::ios_base have these public nested types,
23 // and are non-copyable. This is an imperfect test, but it's the best we
26 yes_type check_is_iostream(
29 , typename T::fmtflags *
30 , typename T::iostate *
31 , typename T::openmode *
32 , typename T::seekdir *
36 no_type check_is_iostream(...);
41 static bool const value = sizeof(yes_type) == sizeof(check_is_iostream<T>(0,0,0,0,0,0));
42 typedef mpl::bool_<value> type;
46 // This should be a customization point. And it serves the same purpose
47 // as the is_noncopyable trait in Boost.Foreach.
54 , is_base_of<noncopyable, T>
58 template<typename T, std::size_t N>
59 struct is_noncopyable<T[N]>