From 8286ac511144e4f17d34eac9affb97e50646344a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:25:44 +0200 Subject: Imported Upstream version 4.0.0 --- libcutl/cutl/details/boost/utility/addressof.hpp | 102 +++++++++++++++++++ libcutl/cutl/details/boost/utility/enable_if.hpp | 119 +++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 libcutl/cutl/details/boost/utility/addressof.hpp create mode 100644 libcutl/cutl/details/boost/utility/enable_if.hpp (limited to 'libcutl/cutl/details/boost/utility') diff --git a/libcutl/cutl/details/boost/utility/addressof.hpp b/libcutl/cutl/details/boost/utility/addressof.hpp new file mode 100644 index 0000000..286312d --- /dev/null +++ b/libcutl/cutl/details/boost/utility/addressof.hpp @@ -0,0 +1,102 @@ +// Copyright (C) 2002 Brad King (brad.king@kitware.com) +// Douglas Gregor (gregod@cs.rpi.edu) +// +// Copyright (C) 2002, 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#ifndef BOOST_UTILITY_ADDRESSOF_HPP +# define BOOST_UTILITY_ADDRESSOF_HPP + +# include +# include + +namespace cutl_details_boost +{ + +namespace detail +{ + +template struct addr_impl_ref +{ + T & v_; + + inline addr_impl_ref( T & v ): v_( v ) {} + inline operator T& () const { return v_; } + +private: + addr_impl_ref & operator=(const addr_impl_ref &); +}; + +template struct addressof_impl +{ + static inline T * f( T & v, long ) + { + return reinterpret_cast( + &const_cast(reinterpret_cast(v))); + } + + static inline T * f( T * v, int ) + { + return v; + } +}; + +} // namespace detail + +template T * addressof( T & v ) +{ +#if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC ) + + return cutl_details_boost::detail::addressof_impl::f( v, 0 ); + +#else + + return cutl_details_boost::detail::addressof_impl::f( cutl_details_boost::detail::addr_impl_ref( v ), 0 ); + +#endif +} + +#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) ) + +namespace detail +{ + +template struct addressof_addp +{ + typedef T * type; +}; + +} // namespace detail + +template< class T, std::size_t N > +typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) +{ + return &t; +} + +#endif + +// Borland doesn't like casting an array reference to a char reference +// but these overloads work around the problem. +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +template +T (*addressof(T (&t)[N]))[N] +{ + return reinterpret_cast(&t); +} + +template +const T (*addressof(const T (&t)[N]))[N] +{ + return reinterpret_cast(&t); +} +#endif + +} // namespace cutl_details_boost + +#endif // BOOST_UTILITY_ADDRESSOF_HPP diff --git a/libcutl/cutl/details/boost/utility/enable_if.hpp b/libcutl/cutl/details/boost/utility/enable_if.hpp new file mode 100644 index 0000000..b01210a --- /dev/null +++ b/libcutl/cutl/details/boost/utility/enable_if.hpp @@ -0,0 +1,119 @@ +// Boost enable_if library + +// Copyright 2003 (c) The Trustees of Indiana University. + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) +// Jeremiah Willcock (jewillco at osl.iu.edu) +// Andrew Lumsdaine (lums at osl.iu.edu) + + +#ifndef BOOST_UTILITY_ENABLE_IF_HPP +#define BOOST_UTILITY_ENABLE_IF_HPP + +#include "cutl/details/boost/config.hpp" + +// Even the definition of enable_if causes problems on some compilers, +// so it's macroed out for all compilers that do not support SFINAE + +#ifndef BOOST_NO_SFINAE + +namespace cutl_details_boost +{ + + template + struct enable_if_c { + typedef T type; + }; + + template + struct enable_if_c {}; + + template + struct enable_if : public enable_if_c {}; + + template + struct lazy_enable_if_c { + typedef typename T::type type; + }; + + template + struct lazy_enable_if_c {}; + + template + struct lazy_enable_if : public lazy_enable_if_c {}; + + + template + struct disable_if_c { + typedef T type; + }; + + template + struct disable_if_c {}; + + template + struct disable_if : public disable_if_c {}; + + template + struct lazy_disable_if_c { + typedef typename T::type type; + }; + + template + struct lazy_disable_if_c {}; + + template + struct lazy_disable_if : public lazy_disable_if_c {}; + +} // namespace cutl_details_boost + +#else + +namespace cutl_details_boost { + + namespace detail { typedef void enable_if_default_T; } + + template + struct enable_if_does_not_work_on_this_compiler; + + template + struct enable_if_c : enable_if_does_not_work_on_this_compiler + { }; + + template + struct disable_if_c : enable_if_does_not_work_on_this_compiler + { }; + + template + struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler + { }; + + template + struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler + { }; + + template + struct enable_if : enable_if_does_not_work_on_this_compiler + { }; + + template + struct disable_if : enable_if_does_not_work_on_this_compiler + { }; + + template + struct lazy_enable_if : enable_if_does_not_work_on_this_compiler + { }; + + template + struct lazy_disable_if : enable_if_does_not_work_on_this_compiler + { }; + +} // namespace cutl_details_boost + +#endif // BOOST_NO_SFINAE + +#endif -- cgit v1.2.3