From 0482e6b8cb3bc42a40dac1cc4e4bff1ac371fa8e Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 25 Jan 2016 23:31:44 +0000 Subject: [PATCH] Add boost::optional --- boost/aligned_storage.hpp | 143 ++ boost/core/explicit_operator_bool.hpp | 154 ++ boost/core/swap.hpp | 60 + boost/detail/reference_content.hpp | 120 ++ boost/exception/exception.hpp | 489 +++++ boost/move/utility.hpp | 149 ++ boost/mpl/size_t.hpp | 25 + boost/mpl/size_t_fwd.hpp | 28 + boost/none.hpp | 53 + boost/none_t.hpp | 28 + boost/optional.hpp | 18 + boost/optional/bad_optional_access.hpp | 32 + boost/optional/optional.hpp | 1567 +++++++++++++++++ boost/optional/optional_fwd.hpp | 30 + boost/optional/optional_io.hpp | 94 + boost/preprocessor/list/append.hpp | 40 + boost/preprocessor/list/transform.hpp | 49 + boost/throw_exception.hpp | 102 ++ boost/type.hpp | 18 + boost/type_traits.hpp | 102 ++ boost/type_traits/add_cv.hpp | 46 + boost/type_traits/aligned_storage.hpp | 13 + boost/type_traits/alignment_of.hpp | 126 ++ boost/type_traits/alignment_traits.hpp | 15 + boost/type_traits/arithmetic_traits.hpp | 20 + boost/type_traits/array_traits.hpp | 15 + boost/type_traits/broken_compiler_spec.hpp | 14 + boost/type_traits/common_type.hpp | 157 ++ boost/type_traits/composite_traits.hpp | 29 + boost/type_traits/conditional.hpp | 25 + boost/type_traits/cv_traits.hpp | 24 + boost/type_traits/decay.hpp | 44 + boost/type_traits/detail/common_type_imp.hpp | 333 ++++ .../detail/has_postfix_operator.hpp | 202 +++ .../detail/has_prefix_operator.hpp | 210 +++ boost/type_traits/detail/size_t_trait_def.hpp | 51 + .../type_traits/detail/size_t_trait_undef.hpp | 16 + boost/type_traits/detail/wrap.hpp | 18 + boost/type_traits/extent.hpp | 141 ++ .../type_traits/floating_point_promotion.hpp | 91 + boost/type_traits/has_bit_and.hpp | 49 + boost/type_traits/has_bit_and_assign.hpp | 55 + boost/type_traits/has_bit_or.hpp | 49 + boost/type_traits/has_bit_or_assign.hpp | 55 + boost/type_traits/has_bit_xor.hpp | 49 + boost/type_traits/has_bit_xor_assign.hpp | 55 + boost/type_traits/has_complement.hpp | 32 + boost/type_traits/has_dereference.hpp | 31 + boost/type_traits/has_divides.hpp | 40 + boost/type_traits/has_divides_assign.hpp | 47 + boost/type_traits/has_equal_to.hpp | 49 + boost/type_traits/has_greater.hpp | 49 + boost/type_traits/has_greater_equal.hpp | 49 + boost/type_traits/has_left_shift.hpp | 49 + boost/type_traits/has_left_shift_assign.hpp | 55 + boost/type_traits/has_less.hpp | 49 + boost/type_traits/has_less_equal.hpp | 49 + boost/type_traits/has_logical_and.hpp | 40 + boost/type_traits/has_logical_not.hpp | 32 + boost/type_traits/has_logical_or.hpp | 40 + boost/type_traits/has_modulus.hpp | 49 + boost/type_traits/has_modulus_assign.hpp | 55 + boost/type_traits/has_multiplies.hpp | 40 + boost/type_traits/has_multiplies_assign.hpp | 47 + boost/type_traits/has_negate.hpp | 25 + boost/type_traits/has_new_operator.hpp | 154 ++ boost/type_traits/has_not_equal_to.hpp | 49 + boost/type_traits/has_nothrow_assign.hpp | 44 + boost/type_traits/has_nothrow_constructor.hpp | 53 + boost/type_traits/has_nothrow_copy.hpp | 53 + boost/type_traits/has_nothrow_destructor.hpp | 25 + boost/type_traits/has_operator.hpp | 51 + boost/type_traits/has_post_decrement.hpp | 44 + boost/type_traits/has_post_increment.hpp | 44 + boost/type_traits/has_pre_decrement.hpp | 44 + boost/type_traits/has_pre_increment.hpp | 44 + boost/type_traits/has_right_shift.hpp | 49 + boost/type_traits/has_right_shift_assign.hpp | 55 + boost/type_traits/has_trivial_assign.hpp | 57 + boost/type_traits/has_trivial_constructor.hpp | 51 + boost/type_traits/has_trivial_copy.hpp | 82 + boost/type_traits/has_trivial_destructor.hpp | 49 + boost/type_traits/has_trivial_move_assign.hpp | 57 + .../has_trivial_move_constructor.hpp | 57 + boost/type_traits/has_unary_minus.hpp | 25 + boost/type_traits/has_unary_plus.hpp | 23 + boost/type_traits/has_virtual_destructor.hpp | 29 + boost/type_traits/is_base_of_tr1.hpp | 48 + boost/type_traits/is_complex.hpp | 34 + boost/type_traits/is_compound.hpp | 46 + boost/type_traits/is_copy_assignable.hpp | 147 ++ boost/type_traits/is_copy_constructible.hpp | 125 ++ boost/type_traits/is_empty.hpp | 142 ++ boost/type_traits/is_final.hpp | 41 + boost/type_traits/is_floating_point.hpp | 27 + .../type_traits/is_member_object_pointer.hpp | 46 + .../is_nothrow_move_assignable.hpp | 108 ++ .../is_nothrow_move_constructible.hpp | 109 ++ boost/type_traits/is_object.hpp | 45 + boost/type_traits/is_stateless.hpp | 48 + boost/type_traits/is_virtual_base_of.hpp | 117 ++ boost/type_traits/object_traits.hpp | 33 + boost/type_traits/promote.hpp | 40 + boost/type_traits/rank.hpp | 89 + boost/type_traits/reference_traits.hpp | 15 + boost/type_traits/remove_all_extents.hpp | 40 + boost/type_traits/remove_extent.hpp | 40 + boost/type_traits/remove_volatile.hpp | 77 + boost/type_traits/same_traits.hpp | 15 + boost/type_traits/transform_traits.hpp | 21 + boost/type_traits/transform_traits_spec.hpp | 14 + boost/type_traits/type_with_alignment.hpp | 357 ++++ boost/utility/compare_pointees.hpp | 68 + build.cmd | 1 + 114 files changed, 9062 insertions(+) create mode 100644 boost/aligned_storage.hpp create mode 100644 boost/core/explicit_operator_bool.hpp create mode 100644 boost/core/swap.hpp create mode 100644 boost/detail/reference_content.hpp create mode 100644 boost/exception/exception.hpp create mode 100644 boost/move/utility.hpp create mode 100644 boost/mpl/size_t.hpp create mode 100644 boost/mpl/size_t_fwd.hpp create mode 100644 boost/none.hpp create mode 100644 boost/none_t.hpp create mode 100644 boost/optional.hpp create mode 100644 boost/optional/bad_optional_access.hpp create mode 100644 boost/optional/optional.hpp create mode 100644 boost/optional/optional_fwd.hpp create mode 100644 boost/optional/optional_io.hpp create mode 100644 boost/preprocessor/list/append.hpp create mode 100644 boost/preprocessor/list/transform.hpp create mode 100644 boost/throw_exception.hpp create mode 100644 boost/type.hpp create mode 100644 boost/type_traits.hpp create mode 100644 boost/type_traits/add_cv.hpp create mode 100644 boost/type_traits/aligned_storage.hpp create mode 100644 boost/type_traits/alignment_of.hpp create mode 100644 boost/type_traits/alignment_traits.hpp create mode 100644 boost/type_traits/arithmetic_traits.hpp create mode 100644 boost/type_traits/array_traits.hpp create mode 100644 boost/type_traits/broken_compiler_spec.hpp create mode 100644 boost/type_traits/common_type.hpp create mode 100644 boost/type_traits/composite_traits.hpp create mode 100644 boost/type_traits/conditional.hpp create mode 100644 boost/type_traits/cv_traits.hpp create mode 100644 boost/type_traits/decay.hpp create mode 100644 boost/type_traits/detail/common_type_imp.hpp create mode 100644 boost/type_traits/detail/has_postfix_operator.hpp create mode 100644 boost/type_traits/detail/has_prefix_operator.hpp create mode 100644 boost/type_traits/detail/size_t_trait_def.hpp create mode 100644 boost/type_traits/detail/size_t_trait_undef.hpp create mode 100644 boost/type_traits/detail/wrap.hpp create mode 100644 boost/type_traits/extent.hpp create mode 100644 boost/type_traits/floating_point_promotion.hpp create mode 100644 boost/type_traits/has_bit_and.hpp create mode 100644 boost/type_traits/has_bit_and_assign.hpp create mode 100644 boost/type_traits/has_bit_or.hpp create mode 100644 boost/type_traits/has_bit_or_assign.hpp create mode 100644 boost/type_traits/has_bit_xor.hpp create mode 100644 boost/type_traits/has_bit_xor_assign.hpp create mode 100644 boost/type_traits/has_complement.hpp create mode 100644 boost/type_traits/has_dereference.hpp create mode 100644 boost/type_traits/has_divides.hpp create mode 100644 boost/type_traits/has_divides_assign.hpp create mode 100644 boost/type_traits/has_equal_to.hpp create mode 100644 boost/type_traits/has_greater.hpp create mode 100644 boost/type_traits/has_greater_equal.hpp create mode 100644 boost/type_traits/has_left_shift.hpp create mode 100644 boost/type_traits/has_left_shift_assign.hpp create mode 100644 boost/type_traits/has_less.hpp create mode 100644 boost/type_traits/has_less_equal.hpp create mode 100644 boost/type_traits/has_logical_and.hpp create mode 100644 boost/type_traits/has_logical_not.hpp create mode 100644 boost/type_traits/has_logical_or.hpp create mode 100644 boost/type_traits/has_modulus.hpp create mode 100644 boost/type_traits/has_modulus_assign.hpp create mode 100644 boost/type_traits/has_multiplies.hpp create mode 100644 boost/type_traits/has_multiplies_assign.hpp create mode 100644 boost/type_traits/has_negate.hpp create mode 100644 boost/type_traits/has_new_operator.hpp create mode 100644 boost/type_traits/has_not_equal_to.hpp create mode 100644 boost/type_traits/has_nothrow_assign.hpp create mode 100644 boost/type_traits/has_nothrow_constructor.hpp create mode 100644 boost/type_traits/has_nothrow_copy.hpp create mode 100644 boost/type_traits/has_nothrow_destructor.hpp create mode 100644 boost/type_traits/has_operator.hpp create mode 100644 boost/type_traits/has_post_decrement.hpp create mode 100644 boost/type_traits/has_post_increment.hpp create mode 100644 boost/type_traits/has_pre_decrement.hpp create mode 100644 boost/type_traits/has_pre_increment.hpp create mode 100644 boost/type_traits/has_right_shift.hpp create mode 100644 boost/type_traits/has_right_shift_assign.hpp create mode 100644 boost/type_traits/has_trivial_assign.hpp create mode 100644 boost/type_traits/has_trivial_constructor.hpp create mode 100644 boost/type_traits/has_trivial_copy.hpp create mode 100644 boost/type_traits/has_trivial_destructor.hpp create mode 100644 boost/type_traits/has_trivial_move_assign.hpp create mode 100644 boost/type_traits/has_trivial_move_constructor.hpp create mode 100644 boost/type_traits/has_unary_minus.hpp create mode 100644 boost/type_traits/has_unary_plus.hpp create mode 100644 boost/type_traits/has_virtual_destructor.hpp create mode 100644 boost/type_traits/is_base_of_tr1.hpp create mode 100644 boost/type_traits/is_complex.hpp create mode 100644 boost/type_traits/is_compound.hpp create mode 100644 boost/type_traits/is_copy_assignable.hpp create mode 100644 boost/type_traits/is_copy_constructible.hpp create mode 100644 boost/type_traits/is_empty.hpp create mode 100644 boost/type_traits/is_final.hpp create mode 100644 boost/type_traits/is_floating_point.hpp create mode 100644 boost/type_traits/is_member_object_pointer.hpp create mode 100644 boost/type_traits/is_nothrow_move_assignable.hpp create mode 100644 boost/type_traits/is_nothrow_move_constructible.hpp create mode 100644 boost/type_traits/is_object.hpp create mode 100644 boost/type_traits/is_stateless.hpp create mode 100644 boost/type_traits/is_virtual_base_of.hpp create mode 100644 boost/type_traits/object_traits.hpp create mode 100644 boost/type_traits/promote.hpp create mode 100644 boost/type_traits/rank.hpp create mode 100644 boost/type_traits/reference_traits.hpp create mode 100644 boost/type_traits/remove_all_extents.hpp create mode 100644 boost/type_traits/remove_extent.hpp create mode 100644 boost/type_traits/remove_volatile.hpp create mode 100644 boost/type_traits/same_traits.hpp create mode 100644 boost/type_traits/transform_traits.hpp create mode 100644 boost/type_traits/transform_traits_spec.hpp create mode 100644 boost/type_traits/type_with_alignment.hpp create mode 100644 boost/utility/compare_pointees.hpp diff --git a/boost/aligned_storage.hpp b/boost/aligned_storage.hpp new file mode 100644 index 0000000..b5455f0 --- /dev/null +++ b/boost/aligned_storage.hpp @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// boost aligned_storage.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002-2003 +// Eric Friedman, Itay Maman +// +// 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) + +#ifndef BOOST_ALIGNED_STORAGE_HPP +#define BOOST_ALIGNED_STORAGE_HPP + +#include // for std::size_t + +#include "boost/config.hpp" +#include "boost/detail/workaround.hpp" +#include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/type_with_alignment.hpp" +#include "boost/type_traits/is_pod.hpp" + +#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/identity.hpp" + +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +namespace detail { namespace aligned_storage { + +BOOST_STATIC_CONSTANT( + std::size_t + , alignment_of_max_align = ::boost::alignment_of::value + ); + +// +// To be TR1 conforming this must be a POD type: +// +template < + std::size_t size_ + , std::size_t alignment_ +> +struct aligned_storage_imp +{ + union data_t + { + char buf[size_]; + + typename ::boost::mpl::eval_if_c< + alignment_ == std::size_t(-1) + , ::boost::mpl::identity< ::boost::detail::max_align > + , ::boost::type_with_alignment + >::type align_; + } data_; + void* address() const { return const_cast(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } +}; + +}} // namespace detail::aligned_storage + +template < + std::size_t size_ + , std::size_t alignment_ = std::size_t(-1) +> +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + ::boost::detail::aligned_storage::aligned_storage_imp +{ + +public: // constants + + typedef ::boost::detail::aligned_storage::aligned_storage_imp type; + + BOOST_STATIC_CONSTANT( + std::size_t + , size = size_ + ); + BOOST_STATIC_CONSTANT( + std::size_t + , alignment = ( + alignment_ == std::size_t(-1) + ? ::boost::detail::aligned_storage::alignment_of_max_align + : alignment_ + ) + ); + +private: // noncopyable + + aligned_storage(const aligned_storage&); + aligned_storage& operator=(const aligned_storage&); + +public: // structors + + aligned_storage() + { + } + + ~aligned_storage() + { + } + +public: // accessors + + void* address() + { + return static_cast(this)->address(); + } + + const void* address() const + { + return static_cast(this)->address(); + } +}; + +// +// Make sure that is_pod recognises aligned_storage<>::type +// as a POD (Note that aligned_storage<> itself is not a POD): +// +template +struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp > + BOOST_TT_AUX_BOOL_C_BASE(true) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) +}; + + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/boost/core/explicit_operator_bool.hpp b/boost/core/explicit_operator_bool.hpp new file mode 100644 index 0000000..a8936e2 --- /dev/null +++ b/boost/core/explicit_operator_bool.hpp @@ -0,0 +1,154 @@ +/* + * Copyright Andrey Semashev 2007 - 2013. + * 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) + */ + +/*! + * \file explicit_operator_bool.hpp + * \author Andrey Semashev + * \date 08.03.2009 + * + * This header defines a compatibility macro that implements an unspecified + * \c bool operator idiom, which is superseded with explicit conversion operators in + * C++11. + */ + +#ifndef BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP +#define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + +/*! + * \brief The macro defines an explicit operator of conversion to \c bool + * + * The macro should be used inside the definition of a class that has to + * support the conversion. The class should also implement operator!, + * in terms of which the conversion operator will be implemented. + */ +#define BOOST_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE explicit operator bool () const\ + {\ + return !this->operator! ();\ + } + +/*! + * \brief The macro defines a noexcept explicit operator of conversion to \c bool + * + * The macro should be used inside the definition of a class that has to + * support the conversion. The class should also implement operator!, + * in terms of which the conversion operator will be implemented. + */ +#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\ + BOOST_FORCEINLINE explicit operator bool () const BOOST_NOEXCEPT\ + {\ + return !this->operator! ();\ + } + +/*! + * \brief The macro defines a constexpr explicit operator of conversion to \c bool + * + * The macro should be used inside the definition of a class that has to + * support the conversion. The class should also implement operator!, + * in terms of which the conversion operator will be implemented. + */ +#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit operator bool () const BOOST_NOEXCEPT\ + {\ + return !this->operator! ();\ + } + +#else // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG) +// Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it +#define BOOST_NO_UNSPECIFIED_BOOL +#endif // (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG) + +#if !defined(BOOST_NO_UNSPECIFIED_BOOL) + +namespace boost { + +namespace detail { + +#if !defined(_MSC_VER) && !defined(__IBMCPP__) + + struct unspecified_bool + { + // NOTE TO THE USER: If you see this in error messages then you tried + // to apply an unsupported operator on the object that supports + // explicit conversion to bool. + struct OPERATORS_NOT_ALLOWED; + static void true_value(OPERATORS_NOT_ALLOWED*) {} + }; + typedef void (*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*); + +#else + + // MSVC and VACPP are too eager to convert pointer to function to void* even though they shouldn't + struct unspecified_bool + { + // NOTE TO THE USER: If you see this in error messages then you tried + // to apply an unsupported operator on the object that supports + // explicit conversion to bool. + struct OPERATORS_NOT_ALLOWED; + void true_value(OPERATORS_NOT_ALLOWED*) {} + }; + typedef void (unspecified_bool::*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*); + +#endif + +} // namespace detail + +} // namespace boost + +#define BOOST_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const\ + {\ + return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\ + } + +#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\ + BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\ + {\ + return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\ + } + +#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE BOOST_CONSTEXPR operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\ + {\ + return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\ + } + +#else // !defined(BOOST_NO_UNSPECIFIED_BOOL) + +#define BOOST_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE operator bool () const\ + {\ + return !this->operator! ();\ + } + +#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\ + BOOST_FORCEINLINE operator bool () const BOOST_NOEXCEPT\ + {\ + return !this->operator! ();\ + } + +#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\ + BOOST_FORCEINLINE BOOST_CONSTEXPR operator bool () const BOOST_NOEXCEPT\ + {\ + return !this->operator! ();\ + } + +#endif // !defined(BOOST_NO_UNSPECIFIED_BOOL) + +#endif // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + +#endif // BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP diff --git a/boost/core/swap.hpp b/boost/core/swap.hpp new file mode 100644 index 0000000..baa1be9 --- /dev/null +++ b/boost/core/swap.hpp @@ -0,0 +1,60 @@ +// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker +// +// 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_CORE_SWAP_HPP +#define BOOST_CORE_SWAP_HPP + +// Note: the implementation of this utility contains various workarounds: +// - swap_impl is put outside the boost namespace, to avoid infinite +// recursion (causing stack overflow) when swapping objects of a primitive +// type. +// - swap_impl has a using-directive, rather than a using-declaration, +// because some compilers (including MSVC 7.1, Borland 5.9.3, and +// Intel 8.1) don't do argument-dependent lookup when it has a +// using-declaration instead. +// - boost::swap has two template arguments, instead of one, to +// avoid ambiguity when swapping objects of a Boost type that does +// not have its own boost::swap overload. + +#include //for std::swap (C++11) +#include //for std::swap (C++98) +#include //for std::size_t +#include + +namespace boost_swap_impl +{ + template + BOOST_GPU_ENABLED + void swap_impl(T& left, T& right) + { + using namespace std;//use std::swap if argument dependent lookup fails + swap(left,right); + } + + template + BOOST_GPU_ENABLED + void swap_impl(T (& left)[N], T (& right)[N]) + { + for (std::size_t i = 0; i < N; ++i) + { + ::boost_swap_impl::swap_impl(left[i], right[i]); + } + } +} + +namespace boost +{ + template + BOOST_GPU_ENABLED + void swap(T1& left, T2& right) + { + ::boost_swap_impl::swap_impl(left, right); + } +} + +#endif diff --git a/boost/detail/reference_content.hpp b/boost/detail/reference_content.hpp new file mode 100644 index 0000000..36b80d2 --- /dev/null +++ b/boost/detail/reference_content.hpp @@ -0,0 +1,120 @@ +//----------------------------------------------------------------------------- +// boost detail/reference_content.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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) + +#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP +#define BOOST_DETAIL_REFERENCE_CONTENT_HPP + +#include "boost/config.hpp" + +# include "boost/mpl/bool.hpp" +# include "boost/type_traits/has_nothrow_copy.hpp" + +#include "boost/mpl/void.hpp" + +namespace boost { + +namespace detail { + +/////////////////////////////////////////////////////////////////////////////// +// (detail) class template reference_content +// +// Non-Assignable wrapper for references. +// +template +class reference_content +{ +private: // representation + + RefT content_; + +public: // structors + + ~reference_content() + { + } + + reference_content(RefT r) + : content_( r ) + { + } + + reference_content(const reference_content& operand) + : content_( operand.content_ ) + { + } + +private: // non-Assignable + + reference_content& operator=(const reference_content&); + +public: // queries + + RefT get() const + { + return content_; + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// (detail) metafunction make_reference_content +// +// Wraps with reference_content if specified type is reference. +// + +template struct make_reference_content; + + +template +struct make_reference_content +{ + typedef T type; +}; + +template +struct make_reference_content< T& > +{ + typedef reference_content type; +}; + + +template <> +struct make_reference_content< mpl::void_ > +{ + template + struct apply + : make_reference_content + { + }; + + typedef mpl::void_ type; +}; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// reference_content type traits specializations +// + + +template +struct has_nothrow_copy< + ::boost::detail::reference_content< T& > + > + : mpl::true_ +{ +}; + + +} // namespace boost + +#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP diff --git a/boost/exception/exception.hpp b/boost/exception/exception.hpp new file mode 100644 index 0000000..d762cf8 --- /dev/null +++ b/boost/exception/exception.hpp @@ -0,0 +1,489 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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) + +#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 +#define UUID_274DA366004E11DCB1DDFE2E56D89593 +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + namespace + exception_detail + { + template + class + refcount_ptr + { + public: + + refcount_ptr(): + px_(0) + { + } + + ~refcount_ptr() + { + release(); + } + + refcount_ptr( refcount_ptr const & x ): + px_(x.px_) + { + add_ref(); + } + + refcount_ptr & + operator=( refcount_ptr const & x ) + { + adopt(x.px_); + return *this; + } + + void + adopt( T * px ) + { + release(); + px_=px; + add_ref(); + } + + T * + get() const + { + return px_; + } + + private: + + T * px_; + + void + add_ref() + { + if( px_ ) + px_->add_ref(); + } + + void + release() + { + if( px_ && px_->release() ) + px_=0; + } + }; + } + + //////////////////////////////////////////////////////////////////////// + + template + class error_info; + + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info throw_line; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef int value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class exception; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + template + class shared_ptr; + + namespace + exception_detail + { + class error_info_base; + struct type_info_; + + struct + error_info_container + { + virtual char const * diagnostic_information( char const * ) const = 0; + virtual shared_ptr get( type_info_ const & ) const = 0; + virtual void set( shared_ptr const &, type_info_ const & ) = 0; + virtual void add_ref() const = 0; + virtual bool release() const = 0; + virtual refcount_ptr clone() const = 0; + + protected: + + ~error_info_container() throw() + { + } + }; + + template + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + char const * get_diagnostic_information( exception const &, char const * ); + + void copy_boost_exception( exception *, exception const * ); + + template + E const & set_info( E const &, error_info const & ); + + template + E const & set_info( E const &, throw_function const & ); + + template + E const & set_info( E const &, throw_file const & ); + + template + E const & set_info( E const &, throw_line const & ); + } + +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class + exception + { + // + public: + template void set( typename Tag::type const & ); + template typename Tag::type const * get() const; + // + + protected: + + exception(): + throw_function_(0), + throw_file_(0), + throw_line_(-1) + { + } + +#ifdef __HP_aCC + //On HP aCC, this protected copy constructor prevents throwing boost::exception. + //On all other platforms, the same effect is achieved by the pure virtual destructor. + exception( exception const & x ) throw(): + data_(x.data_), + throw_function_(x.throw_function_), + throw_file_(x.throw_file_), + throw_line_(x.throw_line_) + { + } +#endif + + virtual ~exception() throw() +#ifndef __HP_aCC + = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. +#endif + ; + +#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310) + public: +#else + private: + + template + friend E const & exception_detail::set_info( E const &, throw_function const & ); + + template + friend E const & exception_detail::set_info( E const &, throw_file const & ); + + template + friend E const & exception_detail::set_info( E const &, throw_line const & ); + + template + friend E const & exception_detail::set_info( E const &, error_info const & ); + + friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); + + template + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend void exception_detail::copy_boost_exception( exception *, exception const * ); +#endif + mutable exception_detail::refcount_ptr data_; + mutable char const * throw_function_; + mutable char const * throw_file_; + mutable int throw_line_; + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + inline + exception:: + ~exception() throw() + { + } + + namespace + exception_detail + { + template + E const & + set_info( E const & x, throw_function const & y ) + { + x.throw_function_=y.v_; + return x; + } + + template + E const & + set_info( E const & x, throw_file const & y ) + { + x.throw_file_=y.v_; + return x; + } + + template + E const & + set_info( E const & x, throw_line const & y ) + { + x.throw_line_=y.v_; + return x; + } + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + template + struct + error_info_injector: + public T, + public exception + { + explicit + error_info_injector( T const & x ): + T(x) + { + } + + ~error_info_injector() throw() + { + } + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + struct large_size { char c[256]; }; + large_size dispatch_boost_exception( exception const * ); + + struct small_size { }; + small_size dispatch_boost_exception( void const * ); + + template + struct enable_error_info_helper; + + template + struct + enable_error_info_helper + { + typedef T type; + }; + + template + struct + enable_error_info_helper + { + typedef error_info_injector type; + }; + + template + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper(0)))>::type type; + }; + } + + template + inline + typename + exception_detail::enable_error_info_return_type::type + enable_error_info( T const & x ) + { + typedef typename exception_detail::enable_error_info_return_type::type rt; + return rt(x); + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class + clone_base + { + public: + + virtual clone_base const * clone() const = 0; + virtual void rethrow() const = 0; + + virtual + ~clone_base() throw() + { + } + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + inline + void + copy_boost_exception( exception * a, exception const * b ) + { + refcount_ptr data; + if( error_info_container * d=b->data_.get() ) + data = d->clone(); + a->throw_file_ = b->throw_file_; + a->throw_line_ = b->throw_line_; + a->throw_function_ = b->throw_function_; + a->data_ = data; + } + + inline + void + copy_boost_exception( void *, void const * ) + { + } + + template + class + clone_impl: + public T, + public virtual clone_base + { + struct clone_tag { }; + clone_impl( clone_impl const & x, clone_tag ): + T(x) + { + copy_boost_exception(this,&x); + } + + public: + + explicit + clone_impl( T const & x ): + T(x) + { + copy_boost_exception(this,&x); + } + + ~clone_impl() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new clone_impl(*this,clone_tag()); + } + + void + rethrow() const + { + throw*this; + } + }; + } + + template + inline + exception_detail::clone_impl + enable_current_exception( T const & x ) + { + return exception_detail::clone_impl(x); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/boost/move/utility.hpp b/boost/move/utility.hpp new file mode 100644 index 0000000..8f9c20b --- /dev/null +++ b/boost/move/utility.hpp @@ -0,0 +1,149 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! This header includes core utilities from and defines +//! some more advanced utilities such as: + +#ifndef BOOST_MOVE_MOVE_UTILITY_HPP +#define BOOST_MOVE_MOVE_UTILITY_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_noexcept() + // + ////////////////////////////////////////////////////////////////////////////// + + template + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation::value && !has_move_emulation_enabled::value + , typename ::boost::move_detail::add_const::type & + >::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return x; + } + + template + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation::value && has_move_emulation_enabled::value + && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, rv&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return *static_cast* >(::boost::move_detail::addressof(x)); + } + + template + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation::value && has_move_emulation_enabled::value + && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value + , rv& + >::type + move_if_noexcept(rv& x) BOOST_NOEXCEPT + { + return x; + } + + template + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation::value && has_move_emulation_enabled::value + && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value + , typename ::boost::move_detail::add_const::type & + >::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return x; + } + + template + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation::value && has_move_emulation_enabled::value + && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value + , typename ::boost::move_detail::add_const::type & + >::type + move_if_noexcept(rv& x) BOOST_NOEXCEPT + { + return x; + } + + } //namespace boost + +#else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + #include + + namespace boost{ + + using ::std::move_if_noexcept; + + } //namespace boost + + #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_noexcept() + // + ////////////////////////////////////////////////////////////////////////////// + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides a way to convert a reference into a rvalue reference + //! in compilers with rvalue references. For other compilers converts T & into + //! ::boost::rv & so that move emulation is activated. Reference + //! would be converted to rvalue reference only if input type is nothrow move + //! constructible or if it has no copy constructor. In all other cases const + //! reference would be returned + template + rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept; + + #else //BOOST_MOVE_DOXYGEN_INVOKED + + template + typename ::boost::move_detail::enable_if_c + < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, T&&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { return ::boost::move(x); } + + template + typename ::boost::move_detail::enable_if_c + < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, const T&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { return x; } + + #endif //BOOST_MOVE_DOXYGEN_INVOKED + + } //namespace boost { + + #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +#include + +#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP diff --git a/boost/mpl/size_t.hpp b/boost/mpl/size_t.hpp new file mode 100644 index 0000000..99e9b41 --- /dev/null +++ b/boost/mpl/size_t.hpp @@ -0,0 +1,25 @@ + +#ifndef BOOST_MPL_SIZE_T_HPP_INCLUDED +#define BOOST_MPL_SIZE_T_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#define AUX_WRAPPER_VALUE_TYPE std::size_t +#define AUX_WRAPPER_NAME size_t +#define AUX_WRAPPER_PARAMS(N) std::size_t N + +#include + +#endif // BOOST_MPL_SIZE_T_HPP_INCLUDED diff --git a/boost/mpl/size_t_fwd.hpp b/boost/mpl/size_t_fwd.hpp new file mode 100644 index 0000000..ffdf4b3 --- /dev/null +++ b/boost/mpl/size_t_fwd.hpp @@ -0,0 +1,28 @@ + +#ifndef BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED +#define BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include // make sure 'size_t' is placed into 'std' +#include + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN + +template< std::size_t N > struct size_t; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +BOOST_MPL_AUX_ADL_BARRIER_DECL(size_t) + +#endif // BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED diff --git a/boost/none.hpp b/boost/none.hpp new file mode 100644 index 0000000..87a6c70 --- /dev/null +++ b/boost/none.hpp @@ -0,0 +1,53 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2014 Andrzej Krzemienski. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_17SEP2003_HPP +#define BOOST_NONE_17SEP2003_HPP + +#include "boost/none_t.hpp" + +// NOTE: Borland users have to include this header outside any precompiled headers +// (bcc<=5.64 cannot include instance data in a precompiled header) +// -- * To be verified, now that there's no unnamed namespace + +namespace boost { + +#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE +none_t const none = (static_cast(0)) ; +#else + +namespace detail { namespace optional_detail { + + // the trick here is to make boost::none defined once as a global but in a header file + template + struct none_instance + { + static const T instance; + }; + + template + const T none_instance::instance = T(); // global, but because 'tis a template, no cpp file required + +} } // namespace detail::optional_detail + + +namespace { + // TU-local + const none_t& none = detail::optional_detail::none_instance::instance; +} + +#endif + +} // namespace boost + +#endif + diff --git a/boost/none_t.hpp b/boost/none_t.hpp new file mode 100644 index 0000000..13ce455 --- /dev/null +++ b/boost/none_t.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2014 Andrzej Krzemienski. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_T_17SEP2003_HPP +#define BOOST_NONE_T_17SEP2003_HPP + +namespace boost { + +#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE +namespace detail { struct none_helper{}; } +typedef int detail::none_helper::*none_t ; +#else +class none_t {}; +#endif + +} // namespace boost + +#endif + diff --git a/boost/optional.hpp b/boost/optional.hpp new file mode 100644 index 0000000..40cf12e --- /dev/null +++ b/boost/optional.hpp @@ -0,0 +1,18 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_OPTIONAL_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_FLC_19NOV2002_HPP + +#include "boost/optional/optional.hpp" + +#endif + diff --git a/boost/optional/bad_optional_access.hpp b/boost/optional/bad_optional_access.hpp new file mode 100644 index 0000000..cabf43f --- /dev/null +++ b/boost/optional/bad_optional_access.hpp @@ -0,0 +1,32 @@ +// Copyright (C) 2014, Andrzej Krzemienski. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com +// +#ifndef BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP +#define BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP + +#include +#if __cplusplus < 201103L +#include // to make converting-ctor std::string(char const*) visible +#endif + +namespace boost { + +class bad_optional_access : public std::logic_error +{ +public: + bad_optional_access() + : std::logic_error("Attempted to access the value of an uninitialized optional object.") + {} +}; + +} // namespace boost + +#endif diff --git a/boost/optional/optional.hpp b/boost/optional/optional.hpp new file mode 100644 index 0000000..9def94e --- /dev/null +++ b/boost/optional/optional.hpp @@ -0,0 +1,1567 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2014, 2015 Andrzej Krzemienski. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +// Revisions: +// 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen +// 05 May 2014 (Added move semantics) Andrzej Krzemienski +// +#ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES) +#define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif + +#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) +// AFAICT only Intel 7 correctly resolves the overload set +// that includes the in-place factory taking functions, +// so for the other icc versions, in-place factory support +// is disabled +#define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) +// BCB (5.5.1) cannot parse the nested template struct in an inplace factory. +#define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT +#endif + +#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581) ) +// BCB (up to 5.64) has the following bug: +// If there is a member function/operator template of the form +// template mfunc( Expr expr ) ; +// some calls are resolved to this even if there are other better matches. +// The effect of this bug is that calls to converting ctors and assignments +// are incrorrectly sink to this general catch-all member function template as shown above. +#define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION +#endif + +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +// GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with +// regard to violation of the strict aliasing rules. The optional< T > storage type is marked +// with this attribute in order to let the compiler know that it will alias objects of type T +// and silence compilation warnings. +#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS +#endif + +// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> +// member template of a factory as used in the optional<> implementation. +// He proposed this simple fix which is to move the call to apply<> outside +// namespace boost. +namespace boost_optional_detail +{ + template + inline void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply(address); + } +} + + +namespace boost { + +class in_place_factory_base ; +class typed_in_place_factory_base ; + +// This forward is needed to refer to namespace scope swap from the member swap +template void swap ( optional& x, optional& y ); + +namespace optional_detail { +// This local class is used instead of that in "aligned_storage.hpp" +// because I've found the 'official' class to ICE BCB5.5 +// when some types are used with optional<> +// (due to sizeof() passed down as a non-type template parameter) +template +class aligned_storage +{ + // Borland ICEs if unnamed unions are used for this! + union + // This works around GCC warnings about breaking strict aliasing rules when casting storage address to T* +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + __attribute__((__may_alias__)) +#endif + dummy_u + { + char data[ sizeof(T) ]; + BOOST_DEDUCED_TYPENAME type_with_alignment< + ::boost::alignment_of::value >::type aligner_; + } dummy_ ; + + public: + +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + void const* address() const { return &dummy_; } + void * address() { return &dummy_; } +#else + void const* address() const { return dummy_.data; } + void * address() { return dummy_.data; } +#endif +} ; + +template +struct types_when_isnt_ref +{ + typedef T const& reference_const_type ; + typedef T & reference_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef T && rval_reference_type ; + typedef T && reference_type_of_temporary_wrapper; +#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + // GCC 4.4 has support for an early draft of rvalue references. The conforming version below + // causes warnings about returning references to a temporary. + static T&& move(T&& r) { return r; } +#else + static rval_reference_type move(reference_type r) { return boost::move(r); } +#endif +#endif + typedef T const* pointer_const_type ; + typedef T * pointer_type ; + typedef T const& argument_type ; +} ; + +template +struct types_when_is_ref +{ + typedef BOOST_DEDUCED_TYPENAME remove_reference::type raw_type ; + + typedef raw_type& reference_const_type ; + typedef raw_type& reference_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME remove_const::type&& rval_reference_type ; + typedef raw_type& reference_type_of_temporary_wrapper; + static reference_type move(reference_type r) { return r; } +#endif + typedef raw_type* pointer_const_type ; + typedef raw_type* pointer_type ; + typedef raw_type& argument_type ; +} ; + +template +void prevent_binding_rvalue_ref_to_optional_lvalue_ref() +{ +#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES + BOOST_STATIC_ASSERT_MSG( + !boost::is_lvalue_reference::value || !boost::is_rvalue_reference::value, + "binding rvalue references to optional lvalue references is disallowed"); +#endif +} + +struct optional_tag {} ; + +template +class optional_base : public optional_tag +{ + private : + + typedef +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + BOOST_DEDUCED_TYPENAME +#endif + ::boost::detail::make_reference_content::type internal_type ; + + typedef aligned_storage storage_type ; + + typedef types_when_isnt_ref types_when_not_ref ; + typedef types_when_is_ref types_when_ref ; + + typedef optional_base this_type ; + + protected : + + typedef T value_type ; + + typedef mpl::true_ is_reference_tag ; + typedef mpl::false_ is_not_reference_tag ; + + typedef BOOST_DEDUCED_TYPENAME is_reference::type is_reference_predicate ; + + public: + typedef BOOST_DEDUCED_TYPENAME mpl::if_::type types ; + + protected: + typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ; + typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME types::rval_reference_type rval_reference_type ; + typedef BOOST_DEDUCED_TYPENAME types::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; +#endif + typedef BOOST_DEDUCED_TYPENAME types::pointer_type pointer_type ; + typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type pointer_const_type ; + typedef BOOST_DEDUCED_TYPENAME types::argument_type argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional_base() + : + m_initialized(false) {} + + // Creates an optional uninitialized. + // No-throw + optional_base ( none_t ) + : + m_initialized(false) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional_base ( argument_type val ) + : + m_initialized(false) + { + construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-construct an optional initialized from an rvalue-ref to 'val'. + // Can throw if T::T(T&&) does + optional_base ( rval_reference_type val ) + : + m_initialized(false) + { + construct( boost::move(val) ); + } +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional. + // Can throw if T::T(T const&) does + optional_base ( bool cond, argument_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(val); + } + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does + optional_base ( optional_base const& rhs ) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + optional_base ( optional_base&& rhs ) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct( boost::move(rhs.get_impl()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + explicit optional_base ( Expr&& expr, PtrExpr const* tag ) + : + m_initialized(false) + { + construct(boost::forward(expr),tag); + } + +#else + // This is used for both converting and in-place constructions. + // Derived classes use the 'tag' to select the appropriate + // implementation (the correct 'construct()' overload) + template + explicit optional_base ( Expr const& expr, Expr const* tag ) + : + m_initialized(false) + { + construct(expr,tag); + } + +#endif + + + // No-throw (assuming T::~T() doesn't) + ~optional_base() { destroy() ; } + + // Assigns from another optional (deep-copies the rhs value) + void assign ( optional_base const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(rhs.get_impl(), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) + void assign ( optional_base&& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(boost::move(rhs.get_impl()), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(boost::move(rhs.get_impl())); + } + } +#endif + + // Assigns from another _convertible_ optional (deep-copies the rhs value) + template + void assign ( optional const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + assign_value(rhs.get(), is_reference_predicate() ); +#else + assign_value(static_cast(rhs.get()), is_reference_predicate() ); +#endif + + else destroy(); + } + else + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + construct(rhs.get()); +#else + construct(static_cast(rhs.get())); +#endif + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-assigns from another _convertible_ optional (deep-moves from the rhs value) + template + void assign ( optional&& rhs ) + { + typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(static_cast(rhs.get()), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(static_cast(rhs.get())); + } + } +#endif + + // Assigns from a T (deep-copies the rhs value) + void assign ( argument_type val ) + { + if (is_initialized()) + assign_value(val, is_reference_predicate() ); + else construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + void assign ( rval_reference_type val ) + { + if (is_initialized()) + assign_value( boost::move(val), is_reference_predicate() ); + else construct( boost::move(val) ); + } +#endif + + // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void assign ( none_t ) BOOST_NOEXCEPT { destroy(); } + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + void assign_expr ( Expr&& expr, ExprPtr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(boost::forward(expr),tag); + else construct(boost::forward(expr),tag); + } +#else + template + void assign_expr ( Expr const& expr, Expr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(expr,tag); + else construct(expr,tag); + } +#endif + +#endif + + public : + + // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void reset() BOOST_NOEXCEPT { destroy(); } + + // **DEPPRECATED** Replaces the current value -if any- with 'val' + void reset ( argument_type val ) { assign(val); } + + // Returns a pointer to the value if this is initialized, otherwise, + // returns NULL. + // No-throw + pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } + pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } + + bool is_initialized() const { return m_initialized ; } + + protected : + + void construct ( argument_type val ) + { + ::new (m_storage.address()) internal_type(val) ; + m_initialized = true ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void construct ( rval_reference_type val ) + { + ::new (m_storage.address()) internal_type( types::move(val) ) ; + m_initialized = true ; + } +#endif + + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void emplace_assign ( Args&&... args ) + { + destroy(); + ::new (m_storage.address()) internal_type( boost::forward(args)... ); + m_initialized = true ; + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void emplace_assign ( Arg&& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( boost::forward(arg) ); + m_initialized = true ; + } + + void emplace_assign () + { + destroy(); + ::new (m_storage.address()) internal_type(); + m_initialized = true ; + } +#else + template + void emplace_assign ( const Arg& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( arg ); + m_initialized = true ; + } + + template + void emplace_assign ( Arg& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( arg ); + m_initialized = true ; + } + + void emplace_assign () + { + destroy(); + ::new (m_storage.address()) internal_type(); + m_initialized = true ; + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs in-place using the given factory + template + void construct ( Expr&& factory, in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr&& factory, typed_in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + +#else + // Constructs in-place using the given factory + template + void construct ( Expr const& factory, in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr const& factory, typed_in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } +#endif + +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr&& expr, void const* ) + { + new (m_storage.address()) internal_type(boost::forward(expr)) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr&& expr, void const* ) + { + assign_value(boost::forward(expr), is_reference_predicate()); + } +#else + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr const& expr, void const* ) + { + new (m_storage.address()) internal_type(expr) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr const& expr, void const* ) + { + assign_value(expr, is_reference_predicate()); + } + +#endif + +#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + // BCB5.64 (and probably lower versions) workaround. + // The in-place factories are supported by means of catch-all constructors + // and assignment operators (the functions are parameterized in terms of + // an arbitrary 'Expr' type) + // This compiler incorrectly resolves the overload set and sinks optional and optional + // to the 'Expr'-taking functions even though explicit overloads are present for them. + // Thus, the following overload is needed to properly handle the case when the 'lhs' + // is another optional. + // + // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error + // instead of choosing the wrong overload + // +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr&& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) internal_type(types::move(expr.get())) ; + m_initialized = true ; + } + } +#else + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr const& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) internal_type(expr.get()) ; + m_initialized = true ; + } + } +#endif +#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + + void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; } + void assign_value ( argument_type val, is_reference_tag ) { construct(val); } +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void assign_value ( rval_reference_type val, is_not_reference_tag ) { get_impl() = static_cast(val); } + void assign_value ( rval_reference_type val, is_reference_tag ) { construct( static_cast(val) ); } +#endif + + void destroy() + { + if ( m_initialized ) + destroy_impl(is_reference_predicate()) ; + } + + reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; } + reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; } + + pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; } + pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; } + + private : + + // internal_type can be either T or reference_content +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + // This workaround is supposed to silence GCC warnings about broken strict aliasing rules + internal_type const* get_object() const + { + union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } + internal_type * get_object() + { + union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } +#else + internal_type const* get_object() const { return static_cast(m_storage.address()); } + internal_type * get_object() { return static_cast (m_storage.address()); } +#endif + + // reference_content lacks an implicit conversion to T&, so the following is needed to obtain a proper reference. + reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } + reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; } + reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } + reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) + void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } +#else + void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; } +#endif + + void destroy_impl ( is_reference_tag ) { m_initialized = false ; } + + // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error. + // Decent compilers should disallow conversions from reference_content* to T*, but just in case, + // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. + pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } + pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } + pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } + pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } + + bool m_initialized ; + storage_type m_storage ; +} ; + +} // namespace optional_detail + +template +class optional : public optional_detail::optional_base +{ + typedef optional_detail::optional_base base ; + + public : + + typedef optional this_type ; + + typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; +#endif + typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; + typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; + typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional() BOOST_NOEXCEPT : base() {} + + // Creates an optional uninitialized. + // No-throw + optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional ( argument_type val ) : base(val) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates an optional initialized with 'move(val)'. + // Can throw if T::T(T &&) does + optional ( rval_reference_type val ) : base( boost::forward(val) ) + {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional ( bool cond, argument_type val ) : base(cond,val) {} + + // NOTE: MSVC needs templated versions first + + // Creates a deep copy of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U const&) does + template + explicit optional ( optional const& rhs ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct(rhs.get()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U&&) does + template + explicit optional ( optional && rhs ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct( boost::move(rhs.get()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + // Creates an optional with an expression which can be either + // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); + // (b) An instance of TypedInPlaceFactory ( i.e. in_place(a,b,...,n); + // (c) Any expression implicitly convertible to the single type + // of a one-argument T's constructor. + // (d*) Weak compilers (BCB) might also resolved Expr as optional and optional + // even though explicit overloads are present for these. + // Depending on the above some T ctor is called. + // Can throw if the resolved T ctor throws. +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + + template + explicit optional ( Expr&& expr, + BOOST_DEDUCED_TYPENAME boost::disable_if_c< + (boost::is_base_of::type>::value) || + boost::is_same::type, none_t>::value >::type* = 0 + ) + : base(boost::forward(expr),boost::addressof(expr)) + {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} + +#else + template + explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does + optional ( optional const& rhs ) : base( static_cast(rhs) ) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + optional ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) + : base( boost::move(rhs) ) + {} + +#endif + // No-throw (assuming T::~T() doesn't) + ~optional() {} + +#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + // Assigns from an expression. See corresponding constructor. + // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + BOOST_DEDUCED_TYPENAME boost::disable_if_c< + boost::is_base_of::type>::value || + boost::is_same::type, none_t>::value, + optional& + >::type + operator= ( Expr&& expr ) + { + optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); + this->assign_expr(boost::forward(expr),boost::addressof(expr)); + return *this ; + } + +#else + template + optional& operator= ( Expr const& expr ) + { + this->assign_expr(expr,boost::addressof(expr)); + return *this ; + } +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + + // Copy-assigns from another convertible optional (converts && deep-copies the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional const& rhs ) + { + this->assign(rhs); + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Move-assigns from another convertible optional (converts && deep-moves the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional && rhs ) + { + this->assign(boost::move(rhs)); + return *this ; + } +#endif + + // Assigns from another optional (deep-copies the rhs value) + // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED + // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) + optional& operator= ( optional const& rhs ) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) + optional& operator= ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } +#endif + + // Assigns from a T (deep-copies the rhs value) + // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED + optional& operator= ( argument_type val ) + { + this->assign( val ) ; + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + optional& operator= ( rval_reference_type val ) + { + optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); + this->assign( boost::move(val) ) ; + return *this ; + } +#endif + + // Assigns from a "none" + // Which destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + optional& operator= ( none_t none_ ) BOOST_NOEXCEPT + { + this->assign( none_ ) ; + return *this ; + } + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void emplace ( Args&&... args ) + { + this->emplace_assign( boost::forward(args)... ); + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void emplace ( Arg&& arg ) + { + this->emplace_assign( boost::forward(arg) ); + } + + void emplace () + { + this->emplace_assign(); + } +#else + template + void emplace ( const Arg& arg ) + { + this->emplace_assign( arg ); + } + + template + void emplace ( Arg& arg ) + { + this->emplace_assign( arg ); + } + + void emplace () + { + this->emplace_assign(); + } +#endif + + void swap( optional & arg ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + // allow for Koenig lookup + boost::swap(*this, arg); + } + + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + + // Returns a copy of the value if this is initialized, 'v' otherwise + reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } + reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } + + // Returns a pointer to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type operator *() const& { return this->get() ; } + reference_type operator *() & { return this->get() ; } + reference_type_of_temporary_wrapper operator *() && { return base::types::move(this->get()) ; } +#else + reference_const_type operator *() const { return this->get() ; } + reference_type operator *() { return this->get() ; } +#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS + +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type value() const& + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() & + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type_of_temporary_wrapper value() && + { + if (this->is_initialized()) + return base::types::move(this->get()) ; + else + throw_exception(bad_optional_access()); + } + +#else + reference_const_type value() const + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or ( U&& v ) const& + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } + + template + value_type value_or ( U&& v ) && + { + if (this->is_initialized()) + return base::types::move(get()); + else + return boost::forward(v); + } +#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + value_type value_or ( U&& v ) const + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } +#else + template + value_type value_or ( U const& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } + + template + value_type value_or ( U& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or_eval ( F f ) const& + { + if (this->is_initialized()) + return get(); + else + return f(); + } + + template + value_type value_or_eval ( F f ) && + { + if (this->is_initialized()) + return base::types::move(get()); + else + return f(); + } +#else + template + value_type value_or_eval ( F f ) const + { + if (this->is_initialized()) + return get(); + else + return f(); + } +#endif + + bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; } + + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() +} ; + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +template +class optional +{ + BOOST_STATIC_ASSERT_MSG(sizeof(T) == 0, "Optional rvalue references are illegal."); +} ; +#endif + +// Returns optional(v) +template +inline +optional make_optional ( T const& v ) +{ + return optional(v); +} + +// Returns optional(cond,v) +template +inline +optional make_optional ( bool cond, T const& v ) +{ + return optional(cond,v); +} + +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_const_type +get ( optional const& opt ) +{ + return opt.get() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_type +get ( optional& opt ) +{ + return opt.get() ; +} + +// Returns a pointer to the value if this is initialized, otherwise, returns NULL. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_const_type +get ( optional const* opt ) +{ + return opt->get_ptr() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_type +get ( optional* opt ) +{ + return opt->get_ptr() ; +} + +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_const_type +get_optional_value_or ( optional const& opt, BOOST_DEDUCED_TYPENAME optional::reference_const_type v ) +{ + return opt.get_value_or(v) ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_type +get_optional_value_or ( optional& opt, BOOST_DEDUCED_TYPENAME optional::reference_type v ) +{ + return opt.get_value_or(v) ; +} + +// Returns a pointer to the value if this is initialized, otherwise, returns NULL. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_const_type +get_pointer ( optional const& opt ) +{ + return opt.get_ptr() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_type +get_pointer ( optional& opt ) +{ + return opt.get_ptr() ; +} + +// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header. +template +std::basic_ostream& +operator<<(std::basic_ostream& os, optional_detail::optional_tag const&) +{ + BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header "); + return os; +} + +// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). +// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. + + +// +// optional vs optional cases +// + +template +inline +bool operator == ( optional const& x, optional const& y ) +{ return equal_pointees(x,y); } + +template +inline +bool operator < ( optional const& x, optional const& y ) +{ return less_pointees(x,y); } + +template +inline +bool operator != ( optional const& x, optional const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( optional const& x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, optional const& y ) +{ return !( x < y ) ; } + + +// +// optional vs T cases +// +template +inline +bool operator == ( optional const& x, T const& y ) +{ return equal_pointees(x, optional(y)); } + +template +inline +bool operator < ( optional const& x, T const& y ) +{ return less_pointees(x, optional(y)); } + +template +inline +bool operator != ( optional const& x, T const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( optional const& x, T const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, T const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, T const& y ) +{ return !( x < y ) ; } + +// +// T vs optional cases +// + +template +inline +bool operator == ( T const& x, optional const& y ) +{ return equal_pointees( optional(x), y ); } + +template +inline +bool operator < ( T const& x, optional const& y ) +{ return less_pointees( optional(x), y ); } + +template +inline +bool operator != ( T const& x, optional const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( T const& x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( T const& x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( T const& x, optional const& y ) +{ return !( x < y ) ; } + + +// +// optional vs none cases +// + +template +inline +bool operator == ( optional const& x, none_t ) BOOST_NOEXCEPT +{ return !x; } + +template +inline +bool operator < ( optional const& x, none_t ) +{ return less_pointees(x,optional() ); } + +template +inline +bool operator != ( optional const& x, none_t ) BOOST_NOEXCEPT +{ return bool(x); } + +template +inline +bool operator > ( optional const& x, none_t y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, none_t y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, none_t y ) +{ return !( x < y ) ; } + +// +// none vs optional cases +// + +template +inline +bool operator == ( none_t , optional const& y ) BOOST_NOEXCEPT +{ return !y; } + +template +inline +bool operator < ( none_t , optional const& y ) +{ return less_pointees(optional() ,y); } + +template +inline +bool operator != ( none_t, optional const& y ) BOOST_NOEXCEPT +{ return bool(y); } + +template +inline +bool operator > ( none_t x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( none_t x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( none_t x, optional const& y ) +{ return !( x < y ) ; } + +namespace optional_detail { + +template struct swap_selector; + +template<> +struct swap_selector +{ + template + static void optional_swap ( optional& x, optional& y ) + { + const bool hasX = !!x; + const bool hasY = !!y; + + if ( !hasX && !hasY ) + return; + + if( !hasX ) + x.emplace(); + else if ( !hasY ) + y.emplace(); + + // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers + boost::swap(x.get(),y.get()); + + if( !hasX ) + y = boost::none ; + else if( !hasY ) + x = boost::none ; + } +}; + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +template<> +struct swap_selector +{ + template + static void optional_swap ( optional& x, optional& y ) + //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) + { + if(x) + { + if (y) + { + boost::swap(*x, *y); + } + else + { + y = boost::move(*x); + x = boost::none; + } + } + else + { + if (y) + { + x = boost::move(*y); + y = boost::none; + } + } + } +}; +#else +template<> +struct swap_selector +{ + template + static void optional_swap ( optional& x, optional& y ) + { + const bool hasX = !!x; + const bool hasY = !!y; + + if ( !hasX && hasY ) + { + x = y.get(); + y = boost::none ; + } + else if ( hasX && !hasY ) + { + y = x.get(); + x = boost::none ; + } + else if ( hasX && hasY ) + { + // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers + boost::swap(x.get(),y.get()); + } + } +}; +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +} // namespace optional_detail + +#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined BOOST_CONFIG_RESTORE_OBSOLETE_SWAP_IMPLEMENTATION) + +template +struct optional_swap_should_use_default_constructor : boost::false_type {} ; + +#else + +template +struct optional_swap_should_use_default_constructor : has_nothrow_default_constructor {} ; + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +template inline void swap ( optional& x, optional& y ) + //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) +{ + optional_detail::swap_selector::value>::optional_swap(x, y); +} + +} // namespace boost + +#endif diff --git a/boost/optional/optional_fwd.hpp b/boost/optional/optional_fwd.hpp new file mode 100644 index 0000000..fb59682 --- /dev/null +++ b/boost/optional/optional_fwd.hpp @@ -0,0 +1,30 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +// Revisions: +// 10 May 2008 (added swap related forward declaration) Niels Dekker +// +#ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP + + +namespace boost { + +template class optional ; + +template void swap ( optional& , optional& ); + +template struct optional_swap_should_use_default_constructor ; + +} // namespace boost + +#endif + diff --git a/boost/optional/optional_io.hpp b/boost/optional/optional_io.hpp new file mode 100644 index 0000000..16dbf95 --- /dev/null +++ b/boost/optional/optional_io.hpp @@ -0,0 +1,94 @@ +// Copyright (C) 2005, Fernando Luis Cacciola Carballal. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP + +#include +#include + +#include +#include "boost/optional/optional.hpp" + + +namespace boost +{ + +template +inline +std::basic_ostream& +operator<<(std::basic_ostream& out, none_t const&) +{ + if (out.good()) + { + out << "--"; + } + + return out; +} + +template +inline +std::basic_ostream& +operator<<(std::basic_ostream& out, optional const& v) +{ + if (out.good()) + { + if (!v) + out << "--" ; + else out << ' ' << *v ; + } + + return out; +} + +template +inline +std::basic_istream& +operator>>(std::basic_istream& in, optional& v) +{ + if (in.good()) + { + int d = in.get(); + if (d == ' ') + { + T x; + in >> x; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + v = boost::move(x); +#else + v = x; +#endif + } + else + { + if (d == '-') + { + d = in.get(); + + if (d == '-') + { + v = none; + return in; + } + } + + in.setstate( std::ios::failbit ); + } + } + + return in; +} + +} // namespace boost + +#endif + diff --git a/boost/preprocessor/list/append.hpp b/boost/preprocessor/list/append.hpp new file mode 100644 index 0000000..26e9d74 --- /dev/null +++ b/boost/preprocessor/list/append.hpp @@ -0,0 +1,40 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.com +# * +# * 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) +# */ +# +# /* Revised by Paul Mensonides (2002) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_LIST_APPEND_HPP +# define BOOST_PREPROCESSOR_LIST_APPEND_HPP +# +# include +# include +# +# /* BOOST_PP_LIST_APPEND */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LIST_APPEND(a, b) BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_APPEND_O, b, a) +# else +# define BOOST_PP_LIST_APPEND(a, b) BOOST_PP_LIST_APPEND_I(a, b) +# define BOOST_PP_LIST_APPEND_I(a, b) BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_APPEND_O, b, a) +# endif +# +# define BOOST_PP_LIST_APPEND_O(d, s, x) (x, s) +# +# /* BOOST_PP_LIST_APPEND_D */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LIST_APPEND_D(d, a, b) BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_APPEND_O, b, a) +# else +# define BOOST_PP_LIST_APPEND_D(d, a, b) BOOST_PP_LIST_APPEND_D_I(d, a, b) +# define BOOST_PP_LIST_APPEND_D_I(d, a, b) BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_APPEND_O, b, a) +# endif +# +# endif diff --git a/boost/preprocessor/list/transform.hpp b/boost/preprocessor/list/transform.hpp new file mode 100644 index 0000000..840f306 --- /dev/null +++ b/boost/preprocessor/list/transform.hpp @@ -0,0 +1,49 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.com +# * +# * 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) +# */ +# +# /* Revised by Paul Mensonides (2002) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_LIST_TRANSFORM_HPP +# define BOOST_PREPROCESSOR_LIST_TRANSFORM_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_LIST_TRANSFORM */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LIST_TRANSFORM(op, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_TRANSFORM_O, (op, data, BOOST_PP_NIL), list)) +# else +# define BOOST_PP_LIST_TRANSFORM(op, data, list) BOOST_PP_LIST_TRANSFORM_I(op, data, list) +# define BOOST_PP_LIST_TRANSFORM_I(op, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_TRANSFORM_O, (op, data, BOOST_PP_NIL), list)) +# endif +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LIST_TRANSFORM_O(d, odr, elem) BOOST_PP_LIST_TRANSFORM_O_D(d, BOOST_PP_TUPLE_ELEM(3, 0, odr), BOOST_PP_TUPLE_ELEM(3, 1, odr), BOOST_PP_TUPLE_ELEM(3, 2, odr), elem) +# else +# define BOOST_PP_LIST_TRANSFORM_O(d, odr, elem) BOOST_PP_LIST_TRANSFORM_O_I(d, BOOST_PP_TUPLE_REM_3 odr, elem) +# define BOOST_PP_LIST_TRANSFORM_O_I(d, im, elem) BOOST_PP_LIST_TRANSFORM_O_D(d, im, elem) +# endif +# +# define BOOST_PP_LIST_TRANSFORM_O_D(d, op, data, res, elem) (op, data, (op(d, data, elem), res)) +# +# /* BOOST_PP_LIST_TRANSFORM_D */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LIST_TRANSFORM_D(d, op, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_TRANSFORM_O, (op, data, BOOST_PP_NIL), list)) +# else +# define BOOST_PP_LIST_TRANSFORM_D(d, op, data, list) BOOST_PP_LIST_TRANSFORM_D_I(d, op, data, list) +# define BOOST_PP_LIST_TRANSFORM_D_I(d, op, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_TRANSFORM_O, (op, data, BOOST_PP_NIL), list)) +# endif +# +# endif diff --git a/boost/throw_exception.hpp b/boost/throw_exception.hpp new file mode 100644 index 0000000..aa977df --- /dev/null +++ b/boost/throw_exception.hpp @@ -0,0 +1,102 @@ +#ifndef UUID_AA15E74A856F11E08B8D93F24824019B +#define UUID_AA15E74A856F11E08B8D93F24824019B +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/throw_exception.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc. +// +// 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) +// +// http://www.boost.org/libs/utility/throw_exception.html +// + +#include +#include +#include + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) +# include +#if !defined(BOOST_THROW_EXCEPTION_CURRENT_FUNCTION) +# include +# define BOOST_THROW_EXCEPTION_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION +#endif +# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_THROW_EXCEPTION_CURRENT_FUNCTION,__FILE__,__LINE__) +#else +# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) +#endif + +namespace boost +{ +#ifdef BOOST_NO_EXCEPTIONS + +void throw_exception( std::exception const & e ); // user defined + +#else + +inline void throw_exception_assert_compatibility( std::exception const & ) { } + +template BOOST_NORETURN inline void throw_exception( E const & e ) +{ + //All boost exceptions are required to derive from std::exception, + //to ensure compatibility with BOOST_NO_EXCEPTIONS. + throw_exception_assert_compatibility(e); + +#ifndef BOOST_EXCEPTION_DISABLE + throw enable_current_exception(enable_error_info(e)); +#else + throw e; +#endif +} + +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) + namespace + exception_detail + { + template + BOOST_NORETURN + void + throw_exception_( E const & x, char const * current_function, char const * file, int line ) + { + boost::throw_exception( + set_info( + set_info( + set_info( + enable_error_info(x), + throw_function(current_function)), + throw_file(file)), + throw_line(line))); + } + } +#endif +} // namespace boost + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/boost/type.hpp b/boost/type.hpp new file mode 100644 index 0000000..ab81c91 --- /dev/null +++ b/boost/type.hpp @@ -0,0 +1,18 @@ +// (C) Copyright David Abrahams 2001. +// 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) + +#ifndef BOOST_TYPE_DWA20010120_HPP +# define BOOST_TYPE_DWA20010120_HPP + +namespace boost { + + // Just a simple "type envelope". Useful in various contexts, mostly to work + // around some MSVC deficiencies. + template + struct type {}; + +} + +#endif // BOOST_TYPE_DWA20010120_HPP diff --git a/boost/type_traits.hpp b/boost/type_traits.hpp new file mode 100644 index 0000000..398c687 --- /dev/null +++ b/boost/type_traits.hpp @@ -0,0 +1,102 @@ +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +// See boost/type_traits/*.hpp for full copyright notices. + +#ifndef BOOST_TYPE_TRAITS_HPP +#define BOOST_TYPE_TRAITS_HPP + +#include "boost/type_traits/add_const.hpp" +#include "boost/type_traits/add_cv.hpp" +#include "boost/type_traits/add_lvalue_reference.hpp" +#include "boost/type_traits/add_pointer.hpp" +#include "boost/type_traits/add_reference.hpp" +#include "boost/type_traits/add_rvalue_reference.hpp" +#include "boost/type_traits/add_volatile.hpp" +#include "boost/type_traits/aligned_storage.hpp" +#include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/common_type.hpp" +#include "boost/type_traits/conditional.hpp" +#include "boost/type_traits/decay.hpp" +#include "boost/type_traits/extent.hpp" +#include "boost/type_traits/floating_point_promotion.hpp" +#include "boost/type_traits/function_traits.hpp" +#if !defined(__BORLANDC__) && !defined(__CUDACC__) +#include "boost/type_traits/has_new_operator.hpp" +#endif +#include "boost/type_traits/has_nothrow_assign.hpp" +#include "boost/type_traits/has_nothrow_constructor.hpp" +#include "boost/type_traits/has_nothrow_copy.hpp" +#include "boost/type_traits/has_nothrow_destructor.hpp" +#include +#include "boost/type_traits/has_trivial_assign.hpp" +#include "boost/type_traits/has_trivial_constructor.hpp" +#include "boost/type_traits/has_trivial_copy.hpp" +#include "boost/type_traits/has_trivial_destructor.hpp" +#include "boost/type_traits/has_trivial_move_assign.hpp" +#include "boost/type_traits/has_trivial_move_constructor.hpp" +#include "boost/type_traits/has_virtual_destructor.hpp" +#include "boost/type_traits/is_abstract.hpp" +#include "boost/type_traits/is_arithmetic.hpp" +#include "boost/type_traits/is_array.hpp" +#include "boost/type_traits/is_base_and_derived.hpp" +#include "boost/type_traits/is_base_of.hpp" +#include "boost/type_traits/is_class.hpp" +#include +#include "boost/type_traits/is_compound.hpp" +#include "boost/type_traits/is_const.hpp" +#include "boost/type_traits/is_convertible.hpp" +#include "boost/type_traits/is_copy_constructible.hpp" +#include "boost/type_traits/is_copy_assignable.hpp" +#include "boost/type_traits/is_empty.hpp" +#include "boost/type_traits/is_enum.hpp" +#include "boost/type_traits/is_float.hpp" +#include "boost/type_traits/is_floating_point.hpp" +#include "boost/type_traits/is_function.hpp" +#include "boost/type_traits/is_fundamental.hpp" +#include "boost/type_traits/is_integral.hpp" +#include "boost/type_traits/is_lvalue_reference.hpp" +#include "boost/type_traits/is_member_function_pointer.hpp" +#include "boost/type_traits/is_member_object_pointer.hpp" +#include "boost/type_traits/is_member_pointer.hpp" +#include "boost/type_traits/is_nothrow_move_assignable.hpp" +#include "boost/type_traits/is_nothrow_move_constructible.hpp" +#include "boost/type_traits/is_object.hpp" +#include "boost/type_traits/is_pod.hpp" +#include "boost/type_traits/is_polymorphic.hpp" +#include "boost/type_traits/is_pointer.hpp" +#include "boost/type_traits/is_reference.hpp" +#include "boost/type_traits/is_rvalue_reference.hpp" +#include "boost/type_traits/is_signed.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/type_traits/is_scalar.hpp" +#include "boost/type_traits/is_stateless.hpp" +#include "boost/type_traits/is_union.hpp" +#include "boost/type_traits/is_unsigned.hpp" +#include "boost/type_traits/is_void.hpp" +#include "boost/type_traits/is_virtual_base_of.hpp" +#include "boost/type_traits/is_volatile.hpp" +#include +#include +#include "boost/type_traits/rank.hpp" +#include "boost/type_traits/remove_bounds.hpp" +#include "boost/type_traits/remove_extent.hpp" +#include "boost/type_traits/remove_all_extents.hpp" +#include "boost/type_traits/remove_const.hpp" +#include "boost/type_traits/remove_cv.hpp" +#include "boost/type_traits/remove_pointer.hpp" +#include "boost/type_traits/remove_reference.hpp" +#include "boost/type_traits/remove_volatile.hpp" +#include "boost/type_traits/type_with_alignment.hpp" +#if !(defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238)) +#include "boost/type_traits/integral_promotion.hpp" +#include "boost/type_traits/promote.hpp" +#endif + +#include "boost/type_traits/ice.hpp" + +#endif // BOOST_TYPE_TRAITS_HPP diff --git a/boost/type_traits/add_cv.hpp b/boost/type_traits/add_cv.hpp new file mode 100644 index 0000000..66625c6 --- /dev/null +++ b/boost/type_traits/add_cv.hpp @@ -0,0 +1,46 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_ADD_CV_HPP_INCLUDED +#define BOOST_TT_ADD_CV_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +// * convert a type T to a const volatile type - add_cv +// this is not required since the result is always +// the same as "T const volatile", but it does suppress warnings +// from some compilers: + +#if defined(BOOST_MSVC) +// This bogus warning will appear when add_volatile is applied to a +// const volatile reference because we can't detect const volatile +// references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_cv,T,T const volatile) + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_cv,T&,T&) + +} // namespace boost + +#include + +#endif // BOOST_TT_ADD_CV_HPP_INCLUDED diff --git a/boost/type_traits/aligned_storage.hpp b/boost/type_traits/aligned_storage.hpp new file mode 100644 index 0000000..5420f26 --- /dev/null +++ b/boost/type_traits/aligned_storage.hpp @@ -0,0 +1,13 @@ + +// Copyright (C) John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED +# define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED +# include +#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED + diff --git a/boost/type_traits/alignment_of.hpp b/boost/type_traits/alignment_of.hpp new file mode 100644 index 0000000..31a5f38 --- /dev/null +++ b/boost/type_traits/alignment_of.hpp @@ -0,0 +1,126 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED +#define BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED + +#include +#include + +#include +// should be the last #include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4121 4512) // alignment is sensitive to packing +#endif +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#pragma option push -Vx- -Ve- +#endif + +namespace boost { + +template struct alignment_of; + +// get the alignment of some arbitrary type: +namespace detail { + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4324) // structure was padded due to __declspec(align()) +#endif +template +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +template +struct alignment_logic +{ + BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S); +}; + + +template< typename T > +struct alignment_of_impl +{ +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) + // + // With MSVC both the native __alignof operator + // and our own logic gets things wrong from time to time :-( + // Using a combination of the two seems to make the most of a bad job: + // + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(::boost::detail::alignment_of_hack) - sizeof(T), + __alignof(T) + >::value)); +#elif !defined(BOOST_ALIGNMENT_OF) + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(::boost::detail::alignment_of_hack) - sizeof(T), + sizeof(T) + >::value)); +#else + // + // We put this here, rather than in the definition of + // alignment_of below, because MSVC's __alignof doesn't + // always work in that context for some unexplained reason. + // (See type_with_alignment tests for test cases). + // + BOOST_STATIC_CONSTANT(std::size_t, value = BOOST_ALIGNMENT_OF(T)); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(alignment_of,T,::boost::detail::alignment_of_impl::value) + +// references have to be treated specially, assume +// that a reference is just a special pointer: +template +struct alignment_of + : public alignment_of +{ +}; +#ifdef __BORLANDC__ +// long double gives an incorrect value of 10 (!) +// unless we do this... +struct long_double_wrapper{ long double ld; }; +template<> struct alignment_of + : public alignment_of{}; +#endif + +// void has to be treated specially: +BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void,0) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const,0) +BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void volatile,0) +BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const volatile,0) +#endif + +} // namespace boost + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#pragma option pop +#endif +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#include + +#endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED + diff --git a/boost/type_traits/alignment_traits.hpp b/boost/type_traits/alignment_traits.hpp new file mode 100644 index 0000000..2ed6934 --- /dev/null +++ b/boost/type_traits/alignment_traits.hpp @@ -0,0 +1,15 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED +#define BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED + +#include +#include + +#endif // BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/arithmetic_traits.hpp b/boost/type_traits/arithmetic_traits.hpp new file mode 100644 index 0000000..e4670e6 --- /dev/null +++ b/boost/type_traits/arithmetic_traits.hpp @@ -0,0 +1,20 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines traits classes for arithmetic types: +// is_void, is_integral, is_float, is_arithmetic, is_fundamental. + +#ifndef BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED +#define BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED + +#include +#include +#include +#include +#include + +#endif // BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/array_traits.hpp b/boost/type_traits/array_traits.hpp new file mode 100644 index 0000000..a68ae73 --- /dev/null +++ b/boost/type_traits/array_traits.hpp @@ -0,0 +1,15 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED +#define BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED + +#include + +#endif // BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/broken_compiler_spec.hpp b/boost/type_traits/broken_compiler_spec.hpp new file mode 100644 index 0000000..3a13273 --- /dev/null +++ b/boost/type_traits/broken_compiler_spec.hpp @@ -0,0 +1,14 @@ + +// Copyright 2001-2003 Aleksey Gurtovoy. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED +#define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED + +#include + +#endif diff --git a/boost/type_traits/common_type.hpp b/boost/type_traits/common_type.hpp new file mode 100644 index 0000000..b52ff16 --- /dev/null +++ b/boost/type_traits/common_type.hpp @@ -0,0 +1,157 @@ +// common_type.hpp ---------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP +#define BOOST_TYPE_TRAITS_COMMON_TYPE_HPP + +#include + +#if defined(__SUNPRO_CC) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) +# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF +#endif +#if defined(__IBMCPP__) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) +# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF +#endif + +//----------------------------------------------------------------------------// +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_COMMON_TYPE_ARITY) +#define BOOST_COMMON_TYPE_ARITY 3 +#endif + +//----------------------------------------------------------------------------// +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) +#include // boost wonders never cease! +#endif + +//----------------------------------------------------------------------------// +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) +#elif defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT) +#include +#include +#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) \ + BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) +#else +#include +#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) +#endif + +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT) +#define BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE "must be complete type" +#endif + +#if defined(BOOST_NO_CXX11_DECLTYPE) && defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) +#include +#include +#endif +#include +#include +#include + +//----------------------------------------------------------------------------// +// // +// C++03 implementation of // +// 20.9.7.6 Other transformations [meta.trans.other] // +// Written by Howard Hinnant // +// Adapted for Boost by Beman Dawes, Vicente Botet and Jeffrey Hellrung // +// // +//----------------------------------------------------------------------------// + +namespace boost { + +// prototype +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template + struct common_type; +#else // or no specialization + template + struct common_type + { + public: + typedef typename common_type::type, V>::type type; + }; +#endif + + +// 1 arg + template +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + struct common_type +#else + struct common_type + +#endif + { + BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); + public: + typedef T type; + }; + +// 2 args +namespace type_traits_detail { + + template + struct common_type_2 + { + private: + BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); + BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(U) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (U)); + static bool declval_bool(); // workaround gcc bug; not required by std + static typename add_rvalue_reference::type declval_T(); // workaround gcc bug; not required by std + static typename add_rvalue_reference::type declval_U(); // workaround gcc bug; not required by std + static typename add_rvalue_reference::type declval_b(); + +#if !defined(BOOST_NO_CXX11_DECLTYPE) + public: + typedef decltype(declval() ? declval() : declval()) type; +#elif defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) + public: + typedef typename detail_type_traits_common_type::common_type_impl< + typename remove_cv::type, + typename remove_cv::type + >::type type; +#else + public: + typedef BOOST_TYPEOF_TPL(declval_b() ? declval_T() : declval_U()) type; +#endif + +#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ == 3 + public: + void public_dummy_function_just_to_silence_warning(); +#endif + }; + + template + struct common_type_2 + { + typedef T type; + }; + } + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template + struct common_type +#else + template + struct common_type +#endif + : public type_traits_detail::common_type_2 + { }; + + +// 3 or more args +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template + struct common_type { + public: + typedef typename common_type::type, V...>::type type; + }; +#endif +} // namespace boost + +#endif // BOOST_TYPE_TRAITS_COMMON_TYPE_HPP diff --git a/boost/type_traits/composite_traits.hpp b/boost/type_traits/composite_traits.hpp new file mode 100644 index 0000000..985a4c5 --- /dev/null +++ b/boost/type_traits/composite_traits.hpp @@ -0,0 +1,29 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines traits classes for composite types: +// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union. +// + +#ifndef BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED +#define BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED + + + + + diff --git a/boost/type_traits/conditional.hpp b/boost/type_traits/conditional.hpp new file mode 100644 index 0000000..8bbda85 --- /dev/null +++ b/boost/type_traits/conditional.hpp @@ -0,0 +1,25 @@ + +// (C) Copyright John Maddock 2010. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_CONDITIONAL_HPP_INCLUDED +#define BOOST_TT_CONDITIONAL_HPP_INCLUDED + +#include + +namespace boost { + +template +struct conditional : public mpl::if_c +{ +}; + +} // namespace boost + + +#endif // BOOST_TT_CONDITIONAL_HPP_INCLUDED diff --git a/boost/type_traits/cv_traits.hpp b/boost/type_traits/cv_traits.hpp new file mode 100644 index 0000000..5bd6c4f --- /dev/null +++ b/boost/type_traits/cv_traits.hpp @@ -0,0 +1,24 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines traits classes for cv-qualified types: +// is_const, is_volatile, remove_const, remove_volatile, remove_cv. + +#ifndef BOOST_TT_CV_TRAITS_HPP_INCLUDED +#define BOOST_TT_CV_TRAITS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TT_CV_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/decay.hpp b/boost/type_traits/decay.hpp new file mode 100644 index 0000000..c23a9b0 --- /dev/null +++ b/boost/type_traits/decay.hpp @@ -0,0 +1,44 @@ +// (C) Copyright John Maddock & Thorsten Ottosen 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_DECAY_HPP_INCLUDED +#define BOOST_TT_DECAY_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + + template< class T > + struct decay + { + private: + typedef BOOST_DEDUCED_TYPENAME remove_reference::type Ty; + public: + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_array, + mpl::identity::type*>, + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_function, + add_pointer, + mpl::identity + > + >::type type; + }; + +} // namespace boost + + +#endif // BOOST_TT_DECAY_HPP_INCLUDED diff --git a/boost/type_traits/detail/common_type_imp.hpp b/boost/type_traits/detail/common_type_imp.hpp new file mode 100644 index 0000000..84de8b4 --- /dev/null +++ b/boost/type_traits/detail/common_type_imp.hpp @@ -0,0 +1,333 @@ +/******************************************************************************* + * boost/type_traits/detail/common_type_imp.hpp + * + * Copyright 2010, Jeffrey Hellrung. + * 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) + * + * struct boost::common_type + * + * common_type::type is the type of the expression + * b() ? x() : y() + * where b() returns a bool, x() has return type T, and y() has return type U. + * See + * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#common_type + * + * Note that this evaluates to void if one or both of T and U is void. + ******************************************************************************/ + +#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP +#define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + +namespace detail_type_traits_common_type +{ + +/******************************************************************************* + * struct propagate_cv< From, To > + * + * This metafunction propagates cv-qualifiers on type From to type To. + ******************************************************************************/ + +template< class From, class To > +struct propagate_cv +{ typedef To type; }; +template< class From, class To > +struct propagate_cv< const From, To > +{ typedef To const type; }; +template< class From, class To > +struct propagate_cv< volatile From, To > +{ typedef To volatile type; }; +template< class From, class To > +struct propagate_cv< const volatile From, To > +{ typedef To const volatile type; }; + +/******************************************************************************* + * struct is_integral_or_enum + * + * This metafunction determines if T is an integral type which can be made + * signed or unsigned. + ******************************************************************************/ + +template< class T > +struct is_integral_or_enum + : public mpl::or_< is_integral, is_enum > +{ }; +template<> +struct is_integral_or_enum< bool > + : public false_type +{ }; + +/******************************************************************************* + * struct make_unsigned_soft + * struct make_signed_soft + * + * These metafunction are identical to make_unsigned and make_signed, + * respectively, except for special-casing bool. + ******************************************************************************/ + +template< class T > +struct make_unsigned_soft + : public make_unsigned +{ }; +template<> +struct make_unsigned_soft< bool > +{ typedef bool type; }; + +template< class T > +struct make_signed_soft + : public make_signed +{ }; +template<> +struct make_signed_soft< bool > +{ typedef bool type; }; + +/******************************************************************************* + * struct sizeof_t + * typedef ... yes_type + * typedef ... no_type + * + * These types are integral players in the use of the "sizeof trick", i.e., we + * can distinguish overload selection by inspecting the size of the return type + * of the overload. + ******************************************************************************/ + +template< std::size_t N > struct sizeof_t { char _dummy[N]; }; +typedef sizeof_t<1> yes_type; +typedef sizeof_t<2> no_type; +BOOST_MPL_ASSERT_RELATION( sizeof( yes_type ), ==, 1 ); +BOOST_MPL_ASSERT_RELATION( sizeof( no_type ), ==, 2 ); + +/******************************************************************************* + * rvalue_test(T&) -> no_type + * rvalue_test(...) -> yes_type + * + * These overloads are used to determine the rvalue-ness of an expression. + ******************************************************************************/ + +template< class T > no_type rvalue_test(T&); +yes_type rvalue_test(...); + +/******************************************************************************* + * struct conversion_test_overloads< Sequence > + * + * This struct has multiple overloads of the static member function apply, each + * one taking a single parameter of a type within the Boost.MPL sequence + * Sequence. Each such apply overload has a return type with sizeof equal to + * one plus the index of the parameter type within Sequence. Thus, we can + * deduce the type T of an expression as long as we can generate a finite set of + * candidate types containing T via these apply overloads and the "sizeof + * trick". + ******************************************************************************/ + +template< class First, class Last, std::size_t Index > +struct conversion_test_overloads_iterate + : public conversion_test_overloads_iterate< + typename mpl::next< First >::type, Last, Index + 1 + > +{ + using conversion_test_overloads_iterate< + typename mpl::next< First >::type, Last, Index + 1 + >::apply; + static sizeof_t< Index + 1 > + apply(typename mpl::deref< First >::type); +}; + +template< class Last, std::size_t Index > +struct conversion_test_overloads_iterate< Last, Last, Index > +{ static sizeof_t< Index + 1 > apply(...); }; + +template< class Sequence > +struct conversion_test_overloads + : public conversion_test_overloads_iterate< + typename mpl::begin< Sequence >::type, + typename mpl::end< Sequence >::type, + 0 + > +{ }; + +/******************************************************************************* + * struct select< Sequence, Index > + * + * select is synonymous with mpl::at_c unless Index equals the size of the + * Boost.MPL Sequence, in which case this evaluates to void. + ******************************************************************************/ + +template< + class Sequence, int Index, + int N = mpl::size< Sequence >::value +> +struct select + : public mpl::at_c< Sequence, Index > +{ }; +template< class Sequence, int N > +struct select< Sequence, N, N > +{ typedef void type; }; + +/******************************************************************************* + * class deduce_common_type< T, U, NominalCandidates > + * struct nominal_candidates + * struct common_type_dispatch_on_rvalueness + * struct common_type_impl + * + * These classes and structs implement the logic behind common_type, which goes + * roughly as follows. Let C be the type of the conditional expression + * declval< bool >() ? declval() : declval() + * if C is an rvalue, then: + * let T' and U' be T and U stripped of reference- and cv-qualifiers + * if T' and U' are pointer types, say, T' = V* and U' = W*, then: + * define the set of NominalCandidates to be + * { V*, W*, V'*, W'* } + * where V' is V with whatever cv-qualifiers are on W, and W' is W + * with whatever cv-qualifiers are on V + * else if T' and U' are both integral or enum types, then: + * define the set of NominalCandidates to be + * { + * unsigned_soft(T'), + * unsigned_soft(U'), + * signed_soft(T'), + * signed_soft(U'), + * T', + * U', + * unsigned int, + * int + * } + * where unsigned_soft(X) is make_unsigned_soft::type and + * signed_soft(X) is make_signed_soft::type (these are all + * generally necessary to cover the various integral promotion cases) + * else + * define the set of NominalCandidates to be + * { T', U' } + * else + * let V and W be T and U stripped of reference-qualifiers + * define the set of NominalCandidates to be + * { V&, W&, V'&, W'& } + * where V' is V with whatever cv-qualifiers are on W, and W' is W with + * whatever cv-qualifiers are on V + * define the set of Candidates to be equal to the set of NominalCandidates with + * duplicates removed, and use this set of Candidates to determine C using the + * conversion_test_overloads struct + ******************************************************************************/ + +template< class T, class U, class NominalCandidates > +class deduce_common_type +{ + typedef typename mpl::copy< + NominalCandidates, + mpl::inserter< + mpl::vector0<>, + mpl::if_< + mpl::contains< mpl::_1, mpl::_2 >, + mpl::_1, + mpl::push_back< mpl::_1, mpl::_2 > + > + > + >::type candidate_types; + static const int best_candidate_index = + sizeof( conversion_test_overloads< candidate_types >::apply( + declval< bool >() ? declval() : declval() + ) ) - 1; +public: + typedef typename select< candidate_types, best_candidate_index >::type type; +}; + +template< + class T, class U, + class V = typename remove_cv< typename remove_reference::type >::type, + class W = typename remove_cv< typename remove_reference::type >::type, + bool = is_integral_or_enum::value && is_integral_or_enum::value +> +struct nominal_candidates +{ typedef mpl::vector2 type; }; + +template< class T, class U, class V, class W > +struct nominal_candidates< T, U, V, W, true > +{ + typedef boost::mpl::vector8< + typename make_unsigned_soft::type, + typename make_unsigned_soft::type, + typename make_signed_soft::type, + typename make_signed_soft::type, + V, W, unsigned int, int + > type; +}; + +template< class T, class U, class V, class W > +struct nominal_candidates< T, U, V*, W*, false > +{ + typedef mpl::vector4< + V*, W*, + typename propagate_cv::type *, + typename propagate_cv::type * + > type; +}; + +template +struct common_type_dispatch_on_rvalueness + : public deduce_common_type< T, U, typename nominal_candidates::type > +{ }; + +template< class T, class U > +struct common_type_dispatch_on_rvalueness< T, U, false > +{ +private: + typedef typename remove_reference::type unrefed_T_type; + typedef typename remove_reference::type unrefed_U_type; +public: + typedef typename deduce_common_type< + T, U, + mpl::vector4< + unrefed_T_type &, + unrefed_U_type &, + typename propagate_cv< unrefed_U_type, unrefed_T_type >::type &, + typename propagate_cv< unrefed_T_type, unrefed_U_type >::type & + > + >::type type; +}; + +template< class T, class U > +struct common_type_impl + : public common_type_dispatch_on_rvalueness() ? declval() : declval() ) ) == sizeof( yes_type ) > +{ }; + +template< class T > struct common_type_impl< T, void > { typedef void type; }; +template< class T > struct common_type_impl< void, T > { typedef void type; }; +template<> struct common_type_impl< void, void > { typedef void type; }; + +} // namespace detail_type_traits_common_type + + +} // namespace boost + +#endif // BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_HPP + diff --git a/boost/type_traits/detail/has_postfix_operator.hpp b/boost/type_traits/detail/has_postfix_operator.hpp new file mode 100644 index 0000000..e9048e1 --- /dev/null +++ b/boost/type_traits/detail/has_postfix_operator.hpp @@ -0,0 +1,202 @@ +// (C) Copyright 2009-2011 Frederic Bron, Robert Stewart, Steven Watanabe & Roman Perepelitsa. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +// avoid warnings +#if defined(__GNUC__) +# pragma GCC system_header +#elif defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4244 4913 ) +#endif + +namespace boost { +namespace detail { + +// This namespace ensures that argument-dependent name lookup does not mess things up. +namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { + +// 1. a function to have an instance of type T without requiring T to be default +// constructible +template T &make(); + + +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&, int); + + +// 3. checks if the operator returns void or not +// conditions: Lhs!=void + +// we first redefine "operator," so that we have no compilation error if +// operator BOOST_TT_TRAIT_OP returns void and we can use the return type of +// (lhs BOOST_TT_TRAIT_OP, returns_void_t()) to deduce if +// operator BOOST_TT_TRAIT_OP returns void or not: +// - operator BOOST_TT_TRAIT_OP returns void -> (lhs BOOST_TT_TRAIT_OP, returns_void_t()) returns returns_void_t +// - operator BOOST_TT_TRAIT_OP returns !=void -> (lhs BOOST_TT_TRAIT_OP, returns_void_t()) returns int +struct returns_void_t { }; +template int operator,(const T&, returns_void_t); +template int operator,(const volatile T&, returns_void_t); + +// this intermediate trait has member value of type bool: +// - value==true -> operator BOOST_TT_TRAIT_OP returns void +// - value==false -> operator BOOST_TT_TRAIT_OP does not return void +template < typename Lhs > +struct operator_returns_void { + // overloads of function returns_void make the difference + // yes_type and no_type have different size by construction + static ::boost::type_traits::yes_type returns_void(returns_void_t); + static ::boost::type_traits::no_type returns_void(int); + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make() BOOST_TT_TRAIT_OP,returns_void_t()))))); +}; + + +// 4. checks if the return type is Ret or Ret==dont_care +// conditions: Lhs!=void + +struct dont_care { }; + +template < typename Lhs, typename Ret, bool Returns_void > +struct operator_returns_Ret; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, dont_care, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, dont_care, false > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, void, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, void, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Ret > +struct operator_returns_Ret < Lhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// otherwise checks if it is convertible to Ret using the sizeof trick +// based on overload resolution +// condition: Ret!=void and Ret!=dont_care and the operator does not return void +template < typename Lhs, typename Ret > +struct operator_returns_Ret < Lhs, Ret, false > { + static ::boost::type_traits::yes_type is_convertible_to_Ret(Ret); // this version is preferred for types convertible to Ret + static ::boost::type_traits::no_type is_convertible_to_Ret(...); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(is_convertible_to_Ret(make() BOOST_TT_TRAIT_OP))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 5. checks for operator existence +// condition: Lhs!=void + +// checks if our definition of operator BOOST_TT_TRAIT_OP is used or an other +// existing one; +// this is done with redefinition of "operator," that returns no_operator or has_operator +struct has_operator { }; +no_operator operator,(no_operator, has_operator); + +template < typename Lhs > +struct operator_exists { + static ::boost::type_traits::yes_type s_check(has_operator); // this version is preferred when operator exists + static ::boost::type_traits::no_type s_check(no_operator); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(s_check(((make() BOOST_TT_TRAIT_OP),make())))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 6. main trait: to avoid any compilation error, this class behaves +// differently when operator BOOST_TT_TRAIT_OP(Lhs) is forbidden by the +// standard. +// Forbidden_if is a bool that is: +// - true when the operator BOOST_TT_TRAIT_OP(Lhs) is forbidden by the standard +// (would yield compilation error if used) +// - false otherwise +template < typename Lhs, typename Ret, bool Forbidden_if > +struct trait_impl1; + +template < typename Lhs, typename Ret > +struct trait_impl1 < Lhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Ret > +struct trait_impl1 < Lhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, + value = ( + ::boost::type_traits::ice_and< + operator_exists < Lhs >::value, + operator_returns_Ret < Lhs, Ret, operator_returns_void < Lhs >::value >::value + >::value + ) + ); +}; + +// specialization needs to be declared for the special void case +template < typename Ret > +struct trait_impl1 < void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// defines some typedef for convenience +template < typename Lhs, typename Ret > +struct trait_impl { + typedef typename ::boost::remove_reference::type Lhs_noref; + typedef typename ::boost::remove_cv::type Lhs_nocv; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer::type >::type >::type Lhs_noptr; + BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Lhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value)); +}; + +} // namespace impl +} // namespace detail + +// this is the accessible definition of the trait to end user +BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Lhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl< Lhs, Ret >::value)) + +} // namespace boost + +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#include diff --git a/boost/type_traits/detail/has_prefix_operator.hpp b/boost/type_traits/detail/has_prefix_operator.hpp new file mode 100644 index 0000000..e1cf8d0 --- /dev/null +++ b/boost/type_traits/detail/has_prefix_operator.hpp @@ -0,0 +1,210 @@ +// (C) Copyright 2009-2011 Frederic Bron, Robert Stewart, Steven Watanabe & Roman Perepelitsa. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +// cannot include this header without getting warnings of the kind: +// gcc: +// warning: value computed is not used +// warning: comparison between signed and unsigned integer expressions +// msvc: +// warning C4146: unary minus operator applied to unsigned type, result still unsigned +// warning C4804: '-' : unsafe use of type 'bool' in operation +// cannot find another implementation -> declared as system header to suppress these warnings. +#if defined(__GNUC__) +# pragma GCC system_header +#elif defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4146 4804 4913 4244 ) +#endif + +namespace boost { +namespace detail { + +// This namespace ensures that argument-dependent name lookup does not mess things up. +namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { + +// 1. a function to have an instance of type T without requiring T to be default +// constructible +template T &make(); + + +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&); + + +// 3. checks if the operator returns void or not +// conditions: Rhs!=void + +// we first redefine "operator," so that we have no compilation error if +// operator BOOST_TT_TRAIT_OP returns void and we can use the return type of +// (BOOST_TT_TRAIT_OP rhs, returns_void_t()) to deduce if +// operator BOOST_TT_TRAIT_OP returns void or not: +// - operator BOOST_TT_TRAIT_OP returns void -> (BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns returns_void_t +// - operator BOOST_TT_TRAIT_OP returns !=void -> (BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns int +struct returns_void_t { }; +template int operator,(const T&, returns_void_t); +template int operator,(const volatile T&, returns_void_t); + +// this intermediate trait has member value of type bool: +// - value==true -> operator BOOST_TT_TRAIT_OP returns void +// - value==false -> operator BOOST_TT_TRAIT_OP does not return void +template < typename Rhs > +struct operator_returns_void { + // overloads of function returns_void make the difference + // yes_type and no_type have different size by construction + static ::boost::type_traits::yes_type returns_void(returns_void_t); + static ::boost::type_traits::no_type returns_void(int); + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((BOOST_TT_TRAIT_OP make(),returns_void_t()))))); +}; + + +// 4. checks if the return type is Ret or Ret==dont_care +// conditions: Rhs!=void + +struct dont_care { }; + +template < typename Rhs, typename Ret, bool Returns_void > +struct operator_returns_Ret; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, dont_care, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, dont_care, false > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, void, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, void, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Rhs, typename Ret > +struct operator_returns_Ret < Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// otherwise checks if it is convertible to Ret using the sizeof trick +// based on overload resolution +// condition: Ret!=void and Ret!=dont_care and the operator does not return void +template < typename Rhs, typename Ret > +struct operator_returns_Ret < Rhs, Ret, false > { + static ::boost::type_traits::yes_type is_convertible_to_Ret(Ret); // this version is preferred for types convertible to Ret + static ::boost::type_traits::no_type is_convertible_to_Ret(...); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(is_convertible_to_Ret(BOOST_TT_TRAIT_OP make()))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 5. checks for operator existence +// condition: Rhs!=void + +// checks if our definition of operator BOOST_TT_TRAIT_OP is used or an other +// existing one; +// this is done with redefinition of "operator," that returns no_operator or has_operator +struct has_operator { }; +no_operator operator,(no_operator, has_operator); + +template < typename Rhs > +struct operator_exists { + static ::boost::type_traits::yes_type s_check(has_operator); // this version is preferred when operator exists + static ::boost::type_traits::no_type s_check(no_operator); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(s_check(((BOOST_TT_TRAIT_OP make()),make())))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 6. main trait: to avoid any compilation error, this class behaves +// differently when operator BOOST_TT_TRAIT_OP(Rhs) is forbidden by the +// standard. +// Forbidden_if is a bool that is: +// - true when the operator BOOST_TT_TRAIT_OP(Rhs) is forbidden by the standard +// (would yield compilation error if used) +// - false otherwise +template < typename Rhs, typename Ret, bool Forbidden_if > +struct trait_impl1; + +template < typename Rhs, typename Ret > +struct trait_impl1 < Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Rhs, typename Ret > +struct trait_impl1 < Rhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, + value = ( + ::boost::type_traits::ice_and< + operator_exists < Rhs >::value, + operator_returns_Ret < Rhs, Ret, operator_returns_void < Rhs >::value >::value + >::value + ) + ); +}; + +// specialization needs to be declared for the special void case +template < typename Ret > +struct trait_impl1 < void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// defines some typedef for convenience +template < typename Rhs, typename Ret > +struct trait_impl { + typedef typename ::boost::remove_reference::type Rhs_noref; + typedef typename ::boost::remove_cv::type Rhs_nocv; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer::type >::type >::type Rhs_noptr; + BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Rhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value)); +}; + +} // namespace impl +} // namespace detail + +// this is the accessible definition of the trait to end user +BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Rhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl < Rhs, Ret >::value)) + +} // namespace boost + +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#include diff --git a/boost/type_traits/detail/size_t_trait_def.hpp b/boost/type_traits/detail/size_t_trait_def.hpp new file mode 100644 index 0000000..8cea9b4 --- /dev/null +++ b/boost/type_traits/detail/size_t_trait_def.hpp @@ -0,0 +1,51 @@ + +// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// 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) + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include + +// Obsolete. Remove. +#define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::integral_constant +#define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ + + +#define BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(trait,T,C) \ +template< typename T > struct trait \ + : public ::boost::integral_constant \ +{ \ +public:\ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ +}; \ +\ +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ +/**/ + +#define BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(trait,spec,C) \ +template<> struct trait \ + : public ::boost::integral_constant \ +{ \ +public:\ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ +}; \ +/**/ + +#define BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,C) \ +template< param > struct trait \ + : public ::boost::integral_constant \ +{ \ +}; \ +/**/ diff --git a/boost/type_traits/detail/size_t_trait_undef.hpp b/boost/type_traits/detail/size_t_trait_undef.hpp new file mode 100644 index 0000000..1694fac --- /dev/null +++ b/boost/type_traits/detail/size_t_trait_undef.hpp @@ -0,0 +1,16 @@ + +// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// 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) + +// $Source$ +// $Date$ +// $Revision$ + +#undef BOOST_TT_AUX_SIZE_T_TRAIT_DEF1 +#undef BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1 +#undef BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1 diff --git a/boost/type_traits/detail/wrap.hpp b/boost/type_traits/detail/wrap.hpp new file mode 100644 index 0000000..d0a75d0 --- /dev/null +++ b/boost/type_traits/detail/wrap.hpp @@ -0,0 +1,18 @@ +// (C) Copyright David Abrahams 2002. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_DETAIL_WRAP_HPP_INCLUDED +#define BOOST_TT_DETAIL_WRAP_HPP_INCLUDED + +namespace boost { +namespace type_traits { + +template struct wrap {}; + +}} // namespace boost::type_traits + +#endif // BOOST_TT_DETAIL_WRAP_HPP_INCLUDED diff --git a/boost/type_traits/extent.hpp b/boost/type_traits/extent.hpp new file mode 100644 index 0000000..c41f7f2 --- /dev/null +++ b/boost/type_traits/extent.hpp @@ -0,0 +1,141 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_EXTENT_HPP_INCLUDED +#define BOOST_TT_EXTENT_HPP_INCLUDED + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +#if defined( __CODEGEARC__ ) + // wrap the impl as main trait provides additional MPL lambda support + template < typename T, std::size_t N > + struct extent_imp { + static const std::size_t value = __array_extent(T, N); + }; + +#else + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) && !defined(__MWERKS__) +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +#endif +#endif + +#endif // non-CodeGear implementation +} // ::boost::detail + +template +struct extent + : public ::boost::integral_constant::value> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent,(T)) +}; + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/floating_point_promotion.hpp b/boost/type_traits/floating_point_promotion.hpp new file mode 100644 index 0000000..8b6ae3a --- /dev/null +++ b/boost/type_traits/floating_point_promotion.hpp @@ -0,0 +1,91 @@ +// Copyright 2005 Alexander Nasonov. +// 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) + +#ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED +#define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED + +#include + +#ifdef BOOST_NO_CV_SPECIALIZATIONS +#include +#include +#include +#include +#include +#include +#endif + +// Should be the last #include +#include + +namespace boost { + +namespace type_traits { namespace detail { + +#ifndef BOOST_NO_CV_SPECIALIZATIONS + +template +struct floating_point_promotion +{ + typedef T type; +}; + +template<> +struct floating_point_promotion +{ + typedef double type; +}; + +template<> +struct floating_point_promotion +{ + typedef double const type; +}; + +template<> +struct floating_point_promotion +{ + typedef double volatile type; +}; + +template<> +struct floating_point_promotion +{ + typedef double const volatile type; +}; + +#else + +template +struct floating_point_promotion + : mpl::at< + mpl::vector< T, double, double const, double volatile, + double const volatile > + , mpl::plus< + is_same + , mpl::multiplies< is_same , mpl::int_<2> > + , mpl::multiplies< is_same , mpl::int_<3> > + , mpl::multiplies< is_same, mpl::int_<4> > + > + > +{ +}; + +#endif + +} } + +BOOST_TT_AUX_TYPE_TRAIT_DEF1( + floating_point_promotion + , T + , BOOST_DEDUCED_TYPENAME + boost::type_traits::detail::floating_point_promotion::type + ) +} + +#include + +#endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED + diff --git a/boost/type_traits/has_bit_and.hpp b/boost/type_traits/has_bit_and.hpp new file mode 100644 index 0000000..ee3307f --- /dev/null +++ b/boost/type_traits/has_bit_and.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_AND_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_AND_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_and +#define BOOST_TT_TRAIT_OP & +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_bit_and_assign.hpp b/boost/type_traits/has_bit_and_assign.hpp new file mode 100644 index 0000000..5b3112a --- /dev/null +++ b/boost/type_traits/has_bit_and_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_and_assign +#define BOOST_TT_TRAIT_OP &= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_bit_or.hpp b/boost/type_traits/has_bit_or.hpp new file mode 100644 index 0000000..922b4ce --- /dev/null +++ b/boost/type_traits/has_bit_or.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_OR_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_OR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_or +#define BOOST_TT_TRAIT_OP | +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_bit_or_assign.hpp b/boost/type_traits/has_bit_or_assign.hpp new file mode 100644 index 0000000..5481b92 --- /dev/null +++ b/boost/type_traits/has_bit_or_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_or_assign +#define BOOST_TT_TRAIT_OP |= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_bit_xor.hpp b/boost/type_traits/has_bit_xor.hpp new file mode 100644 index 0000000..883dcf6 --- /dev/null +++ b/boost/type_traits/has_bit_xor.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_xor +#define BOOST_TT_TRAIT_OP ^ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_bit_xor_assign.hpp b/boost/type_traits/has_bit_xor_assign.hpp new file mode 100644 index 0000000..e2767cc --- /dev/null +++ b/boost/type_traits/has_bit_xor_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_xor_assign +#define BOOST_TT_TRAIT_OP ^= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_complement.hpp b/boost/type_traits/has_complement.hpp new file mode 100644 index 0000000..dafd9f5 --- /dev/null +++ b/boost/type_traits/has_complement.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_COMPLEMENT_HPP_INCLUDED +#define BOOST_TT_HAS_COMPLEMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_complement +#define BOOST_TT_TRAIT_OP ~ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value,\ + /* fundamental non integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_noref >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_dereference.hpp b/boost/type_traits/has_dereference.hpp new file mode 100644 index 0000000..fe48e11 --- /dev/null +++ b/boost/type_traits/has_dereference.hpp @@ -0,0 +1,31 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED +#define BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_dereference +#define BOOST_TT_TRAIT_OP * +#define BOOST_TT_FORBIDDEN_IF\ + /* void* or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_divides.hpp b/boost/type_traits/has_divides.hpp new file mode 100644 index 0000000..277c2da --- /dev/null +++ b/boost/type_traits/has_divides.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DIVIDES_HPP_INCLUDED +#define BOOST_TT_HAS_DIVIDES_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_divides +#define BOOST_TT_TRAIT_OP / +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with pointer or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_divides_assign.hpp b/boost/type_traits/has_divides_assign.hpp new file mode 100644 index 0000000..b21a05a --- /dev/null +++ b/boost/type_traits/has_divides_assign.hpp @@ -0,0 +1,47 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_divides_assign +#define BOOST_TT_TRAIT_OP /= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_equal_to.hpp b/boost/type_traits/has_equal_to.hpp new file mode 100644 index 0000000..c2245c2 --- /dev/null +++ b/boost/type_traits/has_equal_to.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED +#define BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_equal_to +#define BOOST_TT_TRAIT_OP == +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_greater.hpp b/boost/type_traits/has_greater.hpp new file mode 100644 index 0000000..ce32658 --- /dev/null +++ b/boost/type_traits/has_greater.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_GREATER_HPP_INCLUDED +#define BOOST_TT_HAS_GREATER_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_greater +#define BOOST_TT_TRAIT_OP > +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_greater_equal.hpp b/boost/type_traits/has_greater_equal.hpp new file mode 100644 index 0000000..681685a --- /dev/null +++ b/boost/type_traits/has_greater_equal.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED +#define BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_greater_equal +#define BOOST_TT_TRAIT_OP >= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_left_shift.hpp b/boost/type_traits/has_left_shift.hpp new file mode 100644 index 0000000..88205d9 --- /dev/null +++ b/boost/type_traits/has_left_shift.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED +#define BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_left_shift +#define BOOST_TT_TRAIT_OP << +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_left_shift_assign.hpp b/boost/type_traits/has_left_shift_assign.hpp new file mode 100644 index 0000000..0b3b9b1 --- /dev/null +++ b/boost/type_traits/has_left_shift_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_left_shift_assign +#define BOOST_TT_TRAIT_OP <<= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_less.hpp b/boost/type_traits/has_less.hpp new file mode 100644 index 0000000..e1a045e --- /dev/null +++ b/boost/type_traits/has_less.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LESS_HPP_INCLUDED +#define BOOST_TT_HAS_LESS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_less +#define BOOST_TT_TRAIT_OP < +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_less_equal.hpp b/boost/type_traits/has_less_equal.hpp new file mode 100644 index 0000000..c633b8b --- /dev/null +++ b/boost/type_traits/has_less_equal.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED +#define BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_less_equal +#define BOOST_TT_TRAIT_OP <= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_logical_and.hpp b/boost/type_traits/has_logical_and.hpp new file mode 100644 index 0000000..5bfa1c3 --- /dev/null +++ b/boost/type_traits/has_logical_and.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_logical_and +#define BOOST_TT_TRAIT_OP && +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with fundamental non convertible to bool */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_logical_not.hpp b/boost/type_traits/has_logical_not.hpp new file mode 100644 index 0000000..d36858e --- /dev/null +++ b/boost/type_traits/has_logical_not.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_NOT_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_NOT_HPP_INCLUDED + +#if defined(__GNUC__) && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ > 40800) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-value" +#endif + +#define BOOST_TT_TRAIT_NAME has_logical_not +#define BOOST_TT_TRAIT_OP ! +#define BOOST_TT_FORBIDDEN_IF\ + false + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#if defined(__GNUC__) && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ > 40800) +#pragma GCC diagnostic pop +#endif + +#endif diff --git a/boost/type_traits/has_logical_or.hpp b/boost/type_traits/has_logical_or.hpp new file mode 100644 index 0000000..a4ae6c5 --- /dev/null +++ b/boost/type_traits/has_logical_or.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_logical_or +#define BOOST_TT_TRAIT_OP || +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with fundamental non convertible to bool */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_modulus.hpp b/boost/type_traits/has_modulus.hpp new file mode 100644 index 0000000..6948728 --- /dev/null +++ b/boost/type_traits/has_modulus.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MODULUS_HPP_INCLUDED +#define BOOST_TT_HAS_MODULUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_modulus +#define BOOST_TT_TRAIT_OP % +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_modulus_assign.hpp b/boost/type_traits/has_modulus_assign.hpp new file mode 100644 index 0000000..f0531f0 --- /dev/null +++ b/boost/type_traits/has_modulus_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_modulus_assign +#define BOOST_TT_TRAIT_OP %= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_multiplies.hpp b/boost/type_traits/has_multiplies.hpp new file mode 100644 index 0000000..4b578c5 --- /dev/null +++ b/boost/type_traits/has_multiplies.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED +#define BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_multiplies +#define BOOST_TT_TRAIT_OP * +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with pointer or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_multiplies_assign.hpp b/boost/type_traits/has_multiplies_assign.hpp new file mode 100644 index 0000000..1678b7b --- /dev/null +++ b/boost/type_traits/has_multiplies_assign.hpp @@ -0,0 +1,47 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_multiplies_assign +#define BOOST_TT_TRAIT_OP *= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_negate.hpp b/boost/type_traits/has_negate.hpp new file mode 100644 index 0000000..452e54a --- /dev/null +++ b/boost/type_traits/has_negate.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NEGATE_HPP_INCLUDED +#define BOOST_TT_HAS_NEGATE_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_negate +#define BOOST_TT_TRAIT_OP - +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_new_operator.hpp b/boost/type_traits/has_new_operator.hpp new file mode 100644 index 0000000..c615127 --- /dev/null +++ b/boost/type_traits/has_new_operator.hpp @@ -0,0 +1,154 @@ + +// (C) Copyright Runar Undheim, Robert Ramey & John Maddock 2008. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED +#define BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED + +#include // std::nothrow_t +#include // std::size_t +#include +#include +#include + +// should be the last #include +#include + +#if defined(new) +# if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) +# define BOOST_TT_AUX_MACRO_NEW_DEFINED +# pragma push_macro("new") +# undef new +# else +# error "Sorry but you can't include this header if 'new' is defined as a macro." +# endif +#endif + +namespace boost { +namespace detail { + template + struct test; + + template + struct has_new_operator_impl { + template + static type_traits::yes_type check_sig1( + U*, + test< + void *(*)(std::size_t), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig1(...); + + template + static type_traits::yes_type check_sig2( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig2(...); + + template + static type_traits::yes_type check_sig3( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig3(...); + + + template + static type_traits::yes_type check_sig4( + U*, + test< + void *(*)(std::size_t), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig4(...); + + template + static type_traits::yes_type check_sig5( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig5(...); + + template + static type_traits::yes_type check_sig6( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig6(...); + + // GCC2 won't even parse this template if we embed the computation + // of s1 in the computation of value. + #ifdef __GNUC__ + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl::template check_sig1(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl::template check_sig2(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl::template check_sig3(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl::template check_sig4(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl::template check_sig5(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl::template check_sig6(0))); + #else + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(push) + #pragma warning(disable:6334) + #endif + + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6(0))); + + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(pop) + #endif + #endif + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + (s1 == sizeof(type_traits::yes_type)), + (s2 == sizeof(type_traits::yes_type)), + (s3 == sizeof(type_traits::yes_type)), + (s4 == sizeof(type_traits::yes_type)), + (s5 == sizeof(type_traits::yes_type)), + (s6 == sizeof(type_traits::yes_type)) + >::value) + ); + }; +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_new_operator,T,::boost::detail::has_new_operator_impl::value) + +} // namespace boost + +#if defined(BOOST_TT_AUX_MACRO_NEW_DEFINED) +# pragma pop_macro("new") +#endif + +#include + +#endif // BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED diff --git a/boost/type_traits/has_not_equal_to.hpp b/boost/type_traits/has_not_equal_to.hpp new file mode 100644 index 0000000..e7e3700 --- /dev/null +++ b/boost/type_traits/has_not_equal_to.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED +#define BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_not_equal_to +#define BOOST_TT_TRAIT_OP != +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_nothrow_assign.hpp b/boost/type_traits/has_nothrow_assign.hpp new file mode 100644 index 0000000..83e5968 --- /dev/null +++ b/boost/type_traits/has_nothrow_assign.hpp @@ -0,0 +1,44 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct has_nothrow_assign_imp{ +#ifndef BOOST_HAS_NOTHROW_ASSIGN + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_assign::value); +#else + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_ASSIGN(T)); +#endif +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_assign_imp::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_constructor.hpp b/boost/type_traits/has_nothrow_constructor.hpp new file mode 100644 index 0000000..3bc4f80 --- /dev/null +++ b/boost/type_traits/has_nothrow_constructor.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct has_nothrow_constructor_imp{ +#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_CONSTRUCTOR(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_constructor::value); +#endif +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_nothrow_constructor_imp::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_default_constructor,T,::boost::detail::has_nothrow_constructor_imp::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_copy.hpp b/boost/type_traits/has_nothrow_copy.hpp new file mode 100644 index 0000000..9c3c903 --- /dev/null +++ b/boost/type_traits/has_nothrow_copy.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED +#define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct has_nothrow_copy_imp{ +#ifdef BOOST_HAS_NOTHROW_COPY + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_COPY(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_copy::value); +#endif +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy_constructor,T,::boost::detail::has_nothrow_copy_imp::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_destructor.hpp b/boost/type_traits/has_nothrow_destructor.hpp new file mode 100644 index 0000000..4f5882a --- /dev/null +++ b/boost/type_traits/has_nothrow_destructor.hpp @@ -0,0 +1,25 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_destructor,T,::boost::has_trivial_destructor::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_operator.hpp b/boost/type_traits/has_operator.hpp new file mode 100644 index 0000000..c97a90f --- /dev/null +++ b/boost/type_traits/has_operator.hpp @@ -0,0 +1,51 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_OPERATOR_HPP_INCLUDED +#define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/boost/type_traits/has_post_decrement.hpp b/boost/type_traits/has_post_decrement.hpp new file mode 100644 index 0000000..024acb0 --- /dev/null +++ b/boost/type_traits/has_post_decrement.hpp @@ -0,0 +1,44 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED + +#include + +#define BOOST_TT_TRAIT_NAME has_post_decrement +#define BOOST_TT_TRAIT_OP -- +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Lhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value,\ + /* Arrays */ \ + ::boost::is_array::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_post_increment.hpp b/boost/type_traits/has_post_increment.hpp new file mode 100644 index 0000000..b055607 --- /dev/null +++ b/boost/type_traits/has_post_increment.hpp @@ -0,0 +1,44 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED + +#include + +#define BOOST_TT_TRAIT_NAME has_post_increment +#define BOOST_TT_TRAIT_OP ++ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Lhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value,\ + /* Arrays */ \ + ::boost::is_array::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_pre_decrement.hpp b/boost/type_traits/has_pre_decrement.hpp new file mode 100644 index 0000000..feb3d9d --- /dev/null +++ b/boost/type_traits/has_pre_decrement.hpp @@ -0,0 +1,44 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED + +#include + +#define BOOST_TT_TRAIT_NAME has_pre_decrement +#define BOOST_TT_TRAIT_OP -- +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Rhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Rhs_noref >::value\ + >::value,\ + /* Arrays */ \ + ::boost::is_array::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_pre_increment.hpp b/boost/type_traits/has_pre_increment.hpp new file mode 100644 index 0000000..6a2411d --- /dev/null +++ b/boost/type_traits/has_pre_increment.hpp @@ -0,0 +1,44 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED + +#include + +#define BOOST_TT_TRAIT_NAME has_pre_increment +#define BOOST_TT_TRAIT_OP ++ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Rhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Rhs_noref >::value\ + >::value,\ + /* Arrays */ \ + ::boost::is_array::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_right_shift.hpp b/boost/type_traits/has_right_shift.hpp new file mode 100644 index 0000000..5735870 --- /dev/null +++ b/boost/type_traits/has_right_shift.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED +#define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_right_shift +#define BOOST_TT_TRAIT_OP >> +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_right_shift_assign.hpp b/boost/type_traits/has_right_shift_assign.hpp new file mode 100644 index 0000000..0536e71 --- /dev/null +++ b/boost/type_traits/has_right_shift_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_right_shift_assign +#define BOOST_TT_TRAIT_OP >>= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_trivial_assign.hpp b/boost/type_traits/has_trivial_assign.hpp new file mode 100644 index 0000000..404b62c --- /dev/null +++ b/boost/type_traits/has_trivial_assign.hpp @@ -0,0 +1,57 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_assign_impl +{ +#ifdef BOOST_HAS_TRIVIAL_ASSIGN + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_ASSIGN(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_pod::value, + ::boost::type_traits::ice_not< ::boost::is_const::value >::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_assign,T,::boost::detail::has_trivial_assign_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_constructor.hpp b/boost/type_traits/has_trivial_constructor.hpp new file mode 100644 index 0000000..30dbdd8 --- /dev/null +++ b/boost/type_traits/has_trivial_constructor.hpp @@ -0,0 +1,51 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED + +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_ctor_impl +{ +#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_pod::value, + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + >::value)); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_pod::value, + false + >::value)); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_constructor,T,::boost::detail::has_trivial_ctor_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_default_constructor,T,::boost::detail::has_trivial_ctor_impl::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_copy.hpp b/boost/type_traits/has_trivial_copy.hpp new file mode 100644 index 0000000..1c567cf --- /dev/null +++ b/boost/type_traits/has_trivial_copy.hpp @@ -0,0 +1,82 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __clang__ +#include +#endif + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_copy_impl +{ +#ifdef BOOST_HAS_TRIVIAL_COPY +# ifdef __clang__ + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible::value); +# else + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T)); +# endif +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_pod::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +#endif +}; + +#ifdef __clang__ + +template +struct has_trivial_copy_impl +{ + static const bool value = has_trivial_copy_impl::value; +}; + +#endif + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_destructor.hpp b/boost/type_traits/has_trivial_destructor.hpp new file mode 100644 index 0000000..79d7522 --- /dev/null +++ b/boost/type_traits/has_trivial_destructor.hpp @@ -0,0 +1,49 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED + +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_dtor_impl +{ +#ifdef BOOST_HAS_TRIVIAL_DESTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_DESTRUCTOR(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_pod::value); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_destructor,T,::boost::detail::has_trivial_dtor_impl::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_move_assign.hpp b/boost/type_traits/has_trivial_move_assign.hpp new file mode 100644 index 0000000..db337f7 --- /dev/null +++ b/boost/type_traits/has_trivial_move_assign.hpp @@ -0,0 +1,57 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// (C) Copyright Eric Friedman 2002-2003. +// (C) Copyright Antony Polukhin 2013. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_move_assign_impl +{ +#ifdef BOOST_HAS_TRIVIAL_MOVE_ASSIGN + BOOST_STATIC_CONSTANT(bool, value = (BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T))); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_pod::value, + ::boost::type_traits::ice_not< ::boost::is_const::value >::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_move_assign,T,::boost::detail::has_trivial_move_assign_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_move_constructor.hpp b/boost/type_traits/has_trivial_move_constructor.hpp new file mode 100644 index 0000000..a341834 --- /dev/null +++ b/boost/type_traits/has_trivial_move_constructor.hpp @@ -0,0 +1,57 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// (C) Copyright Eric Friedman 2002-2003. +// (C) Copyright Antony Polukhin 2013. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct has_trivial_move_ctor_impl +{ +#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = (BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T))); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_pod::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +#endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_move_constructor,T,::boost::detail::has_trivial_move_ctor_impl::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_unary_minus.hpp b/boost/type_traits/has_unary_minus.hpp new file mode 100644 index 0000000..6b3157f --- /dev/null +++ b/boost/type_traits/has_unary_minus.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED +#define BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_unary_minus +#define BOOST_TT_TRAIT_OP - +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value + + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_unary_plus.hpp b/boost/type_traits/has_unary_plus.hpp new file mode 100644 index 0000000..a61770f --- /dev/null +++ b/boost/type_traits/has_unary_plus.hpp @@ -0,0 +1,23 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_UNARY_PLUS_HPP_INCLUDED +#define BOOST_TT_HAS_UNARY_PLUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_unary_plus +#define BOOST_TT_TRAIT_OP + +#define BOOST_TT_FORBIDDEN_IF\ + false + +#include + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/boost/type_traits/has_virtual_destructor.hpp b/boost/type_traits/has_virtual_destructor.hpp new file mode 100644 index 0000000..b741197 --- /dev/null +++ b/boost/type_traits/has_virtual_destructor.hpp @@ -0,0 +1,29 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED + +#include +// should be the last #include +#include + +namespace boost { + +#ifdef BOOST_HAS_VIRTUAL_DESTRUCTOR +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCTOR(T)) +#else +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_base_of_tr1.hpp b/boost/type_traits/is_base_of_tr1.hpp new file mode 100644 index 0000000..7264f15 --- /dev/null +++ b/boost/type_traits/is_base_of_tr1.hpp @@ -0,0 +1,48 @@ + +// (C) Copyright Rani Sharoni 2003-2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED +#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED + +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { namespace tr1{ + + namespace detail{ + template + struct is_base_of_imp + { + typedef typename remove_cv::type ncvB; + typedef typename remove_cv::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl::value), + (::boost::is_same::value)>::value)); + }; + } + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_base_of + , Base + , Derived + , (::boost::tr1::detail::is_base_of_imp::value)) + +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) + +} } // namespace boost + +#include + +#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED diff --git a/boost/type_traits/is_complex.hpp b/boost/type_traits/is_complex.hpp new file mode 100644 index 0000000..0813dac --- /dev/null +++ b/boost/type_traits/is_complex.hpp @@ -0,0 +1,34 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_COMPLEX_HPP +#define BOOST_TT_IS_COMPLEX_HPP + +#include +#include +// should be the last #include +#include + + +namespace boost { +namespace detail{ + +struct is_convertible_from_tester +{ + template + is_convertible_from_tester(const std::complex&); +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible::value)) + +} // namespace boost + +#include + +#endif //BOOST_TT_IS_COMPLEX_HPP diff --git a/boost/type_traits/is_compound.hpp b/boost/type_traits/is_compound.hpp new file mode 100644 index 0000000..bbaaa42 --- /dev/null +++ b/boost/type_traits/is_compound.hpp @@ -0,0 +1,46 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_COMPOUND_HPP_INCLUDED +#define BOOST_TT_IS_COMPOUND_HPP_INCLUDED + +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +#if !defined( __CODEGEARC__ ) +namespace detail { + +template +struct is_compound_impl +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_not< + ::boost::is_fundamental::value + >::value)); +}; + +} // namespace detail +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,__is_compound(T)) +#else +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,::boost::detail::is_compound_impl::value) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_COMPOUND_HPP_INCLUDED diff --git a/boost/type_traits/is_copy_assignable.hpp b/boost/type_traits/is_copy_assignable.hpp new file mode 100644 index 0000000..48af818 --- /dev/null +++ b/boost/type_traits/is_copy_assignable.hpp @@ -0,0 +1,147 @@ +// (C) Copyright Ion Gaztanaga 2014. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED +#define BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED + +#include +#include +#include +#include + +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \ + && !defined(BOOST_INTEL_CXX_VERSION) && \ + !(defined(BOOST_MSVC) && _MSC_VER == 1800) +#define BOOST_TT_CXX11_IS_COPY_ASSIGNABLE +#include +#else + //For compilers without decltype + #include + #include + #include + #include +#endif + + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct is_copy_assignable_impl2 { + +// Intel compiler has problems with SFINAE for copy constructors and deleted functions: +// +// error: function *function_name* cannot be referenced -- it is a deleted function +// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); +// ^ +// +// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: +// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken +#if defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE) + typedef boost::type_traits::yes_type yes_type; + typedef boost::type_traits::no_type no_type; + + template + static decltype(::boost::declval() = ::boost::declval(), yes_type() ) test(int); + + template + static no_type test(...); + + static const bool value = sizeof(test(0)) == sizeof(yes_type); + +#else + static BOOST_DEDUCED_TYPENAME boost::add_reference::type produce(); + + template + static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); + + static boost::type_traits::yes_type test(...); + // If you see errors like this: + // + // `'T::operator=(const T&)' is private` + // `boost/type_traits/is_copy_assignable.hpp:NN:M: error: within this context` + // + // then you are trying to call that macro for a structure defined like that: + // + // struct T { + // ... + // private: + // T & operator=(const T &); + // ... + // }; + // + // To fix that you must modify your structure: + // + // // C++03 and C++11 version + // struct T: private boost::noncopyable { + // ... + // private: + // T & operator=(const T &); + // ... + // }; + // + // // C++11 version + // struct T { + // ... + // private: + // T& operator=(const T &) = delete; + // ... + // }; + BOOST_STATIC_CONSTANT(bool, value = ( + sizeof(test(produce())) == sizeof(boost::type_traits::yes_type) + )); + #endif +}; + +template +struct is_copy_assignable_impl2 { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct is_copy_assignable_impl { + +#if !defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE) + //For compilers without decltype, at least return false on const types, arrays + //types derived from boost::noncopyable and types defined as BOOST_MOVEABLE_BUT_NOT_COPYABLE + typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type unreferenced_t; + BOOST_STATIC_CONSTANT(bool, value = ( + boost::detail::is_copy_assignable_impl2< + boost::is_base_and_derived::value + || boost::is_const::value || boost::is_array::value + ,T + >::value + )); + #else + BOOST_STATIC_CONSTANT(bool, value = ( + boost::detail::is_copy_assignable_impl2< + boost::is_base_and_derived::value,T + >::value + )); + #endif +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_assignable,T,::boost::detail::is_copy_assignable_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED diff --git a/boost/type_traits/is_copy_constructible.hpp b/boost/type_traits/is_copy_constructible.hpp new file mode 100644 index 0000000..24f5eeb --- /dev/null +++ b/boost/type_traits/is_copy_constructible.hpp @@ -0,0 +1,125 @@ +// (C) Copyright Antony Polukhin 2013. +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct is_copy_constructible_impl2 { + +// Intel compiler has problems with SFINAE for copy constructors and deleted functions: +// +// error: function *function_name* cannot be referenced -- it is a deleted function +// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); +// ^ +// +// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: +// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION) && !(defined(BOOST_MSVC) && _MSC_VER == 1800) + +#ifdef BOOST_NO_CXX11_DECLTYPE + template + static boost::type_traits::yes_type test(T1&, boost::mpl::int_()))>* = 0); +#else + template + static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); +#endif + + static boost::type_traits::no_type test(...); +#else + template + static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); + static boost::type_traits::yes_type test(...); +#endif + + // If you see errors like this: + // + // `'T::T(const T&)' is private` + // `boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context` + // + // then you are trying to call that macro for a structure defined like that: + // + // struct T { + // ... + // private: + // T(const T &); + // ... + // }; + // + // To fix that you must modify your structure: + // + // // C++03 and C++11 version + // struct T: private boost::noncopyable { + // ... + // private: + // T(const T &); + // ... + // }; + // + // // C++11 version + // struct T { + // ... + // private: + // T(const T &) = delete; + // ... + // }; + BOOST_STATIC_CONSTANT(bool, value = ( + sizeof(test( + boost::declval::type>() + )) == sizeof(boost::type_traits::yes_type) + || + boost::is_rvalue_reference::value + )); +}; + +template +struct is_copy_constructible_impl2 { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct is_copy_constructible_impl { + + BOOST_STATIC_CONSTANT(bool, value = ( + boost::detail::is_copy_constructible_impl2< + boost::is_base_and_derived::value, + T + >::value + )); +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_constructible,T,::boost::detail::is_copy_constructible_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_empty.hpp b/boost/type_traits/is_empty.hpp new file mode 100644 index 0000000..adb239e --- /dev/null +++ b/boost/type_traits/is_empty.hpp @@ -0,0 +1,142 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_EMPTY_HPP_INCLUDED +#define BOOST_TT_IS_EMPTY_HPP_INCLUDED + +#include +#include +#include +#include + +# include +# include +# include + +// should be always the last #include directive +#include + +#ifndef BOOST_INTERNAL_IS_EMPTY +#define BOOST_INTERNAL_IS_EMPTY(T) false +#else +#define BOOST_INTERNAL_IS_EMPTY(T) BOOST_IS_EMPTY(T) +#endif + +namespace boost { + +namespace detail { + + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4624) // destructor could not be generated +#endif + +template +struct empty_helper_t1 : public T +{ + empty_helper_t1(); // hh compiler bug workaround + int i[256]; +private: + // suppress compiler warnings: + empty_helper_t1(const empty_helper_t1&); + empty_helper_t1& operator=(const empty_helper_t1&); +}; + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +struct empty_helper_t2 { int i[256]; }; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) + +template +struct empty_helper +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct empty_helper +{ + BOOST_STATIC_CONSTANT( + bool, value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)) + ); +}; + +template +struct is_empty_impl +{ + typedef typename remove_cv::type cvt; + BOOST_STATIC_CONSTANT( + bool, value = ( + ::boost::type_traits::ice_or< + ::boost::detail::empty_helper::value>::value + , BOOST_INTERNAL_IS_EMPTY(cvt) + >::value + )); +}; + +#else // __BORLANDC__ + +template +struct empty_helper +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct empty_helper +{ + BOOST_STATIC_CONSTANT(bool, value = ( + sizeof(empty_helper_t1) == sizeof(empty_helper_t2) + )); +}; + +template +struct is_empty_impl +{ + typedef typename remove_cv::type cvt; + typedef typename add_reference::type r_type; + + BOOST_STATIC_CONSTANT( + bool, value = ( + ::boost::type_traits::ice_or< + ::boost::detail::empty_helper< + cvt + , ::boost::is_class::value + , ::boost::is_convertible< r_type,int>::value + >::value + , BOOST_INTERNAL_IS_EMPTY(cvt) + >::value)); +}; + +#endif // __BORLANDC__ + + +// these help when the compiler has no partial specialization support: +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const volatile,false) +#endif + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl::value) + +} // namespace boost + +#include + +#undef BOOST_INTERNAL_IS_EMPTY + +#endif // BOOST_TT_IS_EMPTY_HPP_INCLUDED + diff --git a/boost/type_traits/is_final.hpp b/boost/type_traits/is_final.hpp new file mode 100644 index 0000000..36bd62e --- /dev/null +++ b/boost/type_traits/is_final.hpp @@ -0,0 +1,41 @@ + +// Copyright (c) 2014 Agustin Berge +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_FINAL_HPP_INCLUDED +#define BOOST_TT_IS_FINAL_HPP_INCLUDED + +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { +template struct is_final_impl +{ +#ifdef BOOST_IS_FINAL + typedef typename remove_cv::type cvt; + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_FINAL(cvt)); +#else + BOOST_STATIC_CONSTANT(bool, value = false); +#endif +}; +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_final,T,::boost::detail::is_final_impl::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_FINAL_HPP_INCLUDED diff --git a/boost/type_traits/is_floating_point.hpp b/boost/type_traits/is_floating_point.hpp new file mode 100644 index 0000000..2224453 --- /dev/null +++ b/boost/type_traits/is_floating_point.hpp @@ -0,0 +1,27 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED + +// should be the last #include +#include + +namespace boost { + +//* is a type T a floating-point type described in the standard (3.9.1p8) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_floating_point,T,false) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,float,true) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,double,true) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true) + +} // namespace boost + +#include + +#endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/boost/type_traits/is_member_object_pointer.hpp b/boost/type_traits/is_member_object_pointer.hpp new file mode 100644 index 0000000..66b76c9 --- /dev/null +++ b/boost/type_traits/is_member_object_pointer.hpp @@ -0,0 +1,46 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED +#define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED + +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +template +struct is_member_object_pointer_impl +{ + BOOST_STATIC_CONSTANT( + bool, value = (::boost::type_traits::ice_and< + ::boost::is_member_pointer::value, + ::boost::type_traits::ice_not< + ::boost::is_member_function_pointer::value + >::value + >::value )); +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_member_object_pointer_impl::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_nothrow_move_assignable.hpp b/boost/type_traits/is_nothrow_move_assignable.hpp new file mode 100644 index 0000000..3268307 --- /dev/null +++ b/boost/type_traits/is_nothrow_move_assignable.hpp @@ -0,0 +1,108 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// (C) Copyright Eric Friedman 2002-2003. +// (C) Copyright Antony Polukhin 2013. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED +#define BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +#ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN + +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_ASSIGN(T)); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = false); }; + + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) + +template +struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {}; + +template +struct false_or_cpp11_noexcept_move_assignable < + T, + typename ::boost::enable_if_c() = ::boost::declval())>::type + > : public ::boost::integral_constant() = ::boost::declval())> +{}; + +template +struct is_nothrow_move_assignable_imp{ + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::false_or_cpp11_noexcept_move_assignable::value); +}; + +template +struct is_nothrow_move_assignable_imp : public ::boost::false_type {}; +template +struct is_nothrow_move_assignable_imp : public ::boost::false_type{}; +template +struct is_nothrow_move_assignable_imp : public ::boost::false_type{}; +template +struct is_nothrow_move_assignable_imp : public ::boost::false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct is_nothrow_move_assignable_imp : public ::boost::false_type{}; +#endif + +#else + +template +struct is_nothrow_move_assignable_imp{ + BOOST_STATIC_CONSTANT(bool, value = ( + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::has_trivial_move_assign::value, + ::boost::has_nothrow_assign::value + >::value, + ::boost::type_traits::ice_not< ::boost::is_array::value >::value + >::value)); +}; + +#endif + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_assignable,T,::boost::detail::is_nothrow_move_assignable_imp::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED diff --git a/boost/type_traits/is_nothrow_move_constructible.hpp b/boost/type_traits/is_nothrow_move_constructible.hpp new file mode 100644 index 0000000..c09d5d1 --- /dev/null +++ b/boost/type_traits/is_nothrow_move_constructible.hpp @@ -0,0 +1,109 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// (C) Copyright Eric Friedman 2002-2003. +// (C) Copyright Antony Polukhin 2013. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail{ + +#ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT + +template +struct is_nothrow_move_constructible_imp{ + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)); +}; + +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type {}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#endif + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) + +template +struct false_or_cpp11_noexcept_move_constructible: public ::boost::false_type {}; + +template +struct false_or_cpp11_noexcept_move_constructible < + T, + typename ::boost::enable_if_c()))>::type + > : public ::boost::integral_constant()))> +{}; + +template +struct is_nothrow_move_constructible_imp{ + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::false_or_cpp11_noexcept_move_constructible::value); +}; + +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type {}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct is_nothrow_move_constructible_imp : public ::boost::false_type{}; +#endif + +#else + +template +struct is_nothrow_move_constructible_imp{ + BOOST_STATIC_CONSTANT(bool, value =( + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::has_trivial_move_constructor::value, + ::boost::has_nothrow_copy::value + >::value, + ::boost::type_traits::ice_not< ::boost::is_array::value >::value + >::value)); +}; + +#endif + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_constructible,T,::boost::detail::is_nothrow_move_constructible_imp::value) + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void volatile,false) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_object.hpp b/boost/type_traits/is_object.hpp new file mode 100644 index 0000000..1d1ae4f --- /dev/null +++ b/boost/type_traits/is_object.hpp @@ -0,0 +1,45 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_OBJECT_HPP_INCLUDED +#define BOOST_TT_IS_OBJECT_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct is_object_impl +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< ::boost::is_void::value>::value, + ::boost::type_traits::ice_not< ::boost::is_function::value>::value + >::value)); +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_object,T,::boost::detail::is_object_impl::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_OBJECT_HPP_INCLUDED diff --git a/boost/type_traits/is_stateless.hpp b/boost/type_traits/is_stateless.hpp new file mode 100644 index 0000000..d8d4063 --- /dev/null +++ b/boost/type_traits/is_stateless.hpp @@ -0,0 +1,48 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_STATELESS_HPP_INCLUDED +#define BOOST_TT_IS_STATELESS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct is_stateless_impl +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::has_trivial_constructor::value, + ::boost::has_trivial_copy::value, + ::boost::has_trivial_destructor::value, + ::boost::is_class::value, + ::boost::is_empty::value + >::value)); +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_stateless,T,::boost::detail::is_stateless_impl::value) + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_STATELESS_HPP_INCLUDED diff --git a/boost/type_traits/is_virtual_base_of.hpp b/boost/type_traits/is_virtual_base_of.hpp new file mode 100644 index 0000000..3daad1b --- /dev/null +++ b/boost/type_traits/is_virtual_base_of.hpp @@ -0,0 +1,117 @@ +// (C) Copyright Daniel Frey and Robert Ramey 2009. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED +#define BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED + +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { +namespace detail { + + +#ifdef BOOST_MSVC +#pragma warning( push ) +#pragma warning( disable : 4584 4250) +#elif defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +template +struct is_virtual_base_of_impl +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct is_virtual_base_of_impl +{ + union max_align + { + unsigned u; + unsigned long ul; + void* v; + double d; + long double ld; +#ifndef BOOST_NO_LONG_LONG + long long ll; +#endif + }; +#ifdef __BORLANDC__ + struct boost_type_traits_internal_struct_X : public virtual Derived, public virtual Base + { + boost_type_traits_internal_struct_X(); + boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&); + boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&); + ~boost_type_traits_internal_struct_X()throw(); + max_align data[4]; + }; + struct boost_type_traits_internal_struct_Y : public virtual Derived + { + boost_type_traits_internal_struct_Y(); + boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&); + boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&); + ~boost_type_traits_internal_struct_Y()throw(); + max_align data[4]; + }; +#else + struct boost_type_traits_internal_struct_X : public Derived, virtual Base + { + boost_type_traits_internal_struct_X(); + boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&); + boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&); + ~boost_type_traits_internal_struct_X()throw(); + max_align data[16]; + }; + struct boost_type_traits_internal_struct_Y : public Derived + { + boost_type_traits_internal_struct_Y(); + boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&); + boost_type_traits_internal_struct_Y& operator=(const boost_type_traits_internal_struct_Y&); + ~boost_type_traits_internal_struct_Y()throw(); + max_align data[16]; + }; +#endif + BOOST_STATIC_CONSTANT(bool, value = (sizeof(boost_type_traits_internal_struct_X)==sizeof(boost_type_traits_internal_struct_Y))); +}; + +template +struct is_virtual_base_of_impl2 +{ + typedef typename mpl::and_, mpl::not_ > >::type tag_type; + typedef is_virtual_base_of_impl imp; + BOOST_STATIC_CONSTANT(bool, value = imp::value); +}; + +#ifdef BOOST_MSVC +#pragma warning( pop ) +#endif + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_virtual_base_of + , Base + , Derived + , (::boost::detail::is_virtual_base_of_impl2::value) +) + +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived&,false) + +} // namespace boost + +#include + +#endif diff --git a/boost/type_traits/object_traits.hpp b/boost/type_traits/object_traits.hpp new file mode 100644 index 0000000..c812a62 --- /dev/null +++ b/boost/type_traits/object_traits.hpp @@ -0,0 +1,33 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines object traits classes: +// is_object, is_scalar, is_class, is_compound, is_pod, +// has_trivial_constructor, has_trivial_copy, has_trivial_assign, +// has_trivial_destructor, is_empty. +// + +#ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED +#define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED diff --git a/boost/type_traits/promote.hpp b/boost/type_traits/promote.hpp new file mode 100644 index 0000000..60f6278 --- /dev/null +++ b/boost/type_traits/promote.hpp @@ -0,0 +1,40 @@ +// Copyright 2005 Alexander Nasonov. +// 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) + +#ifndef FILE_boost_type_traits_promote_hpp_INCLUDED +#define FILE_boost_type_traits_promote_hpp_INCLUDED + +#include +#include +#include + +// Should be the last #include +#include + +namespace boost { + +namespace detail { + +template +struct promote_impl + : public integral_promotion< + BOOST_DEDUCED_TYPENAME floating_point_promotion::type + > +{ +}; + +} + +BOOST_TT_AUX_TYPE_TRAIT_DEF1( + promote + , T + , BOOST_DEDUCED_TYPENAME boost::detail::promote_impl::type + ) +} + +#include + +#endif // #ifndef FILE_boost_type_traits_promote_hpp_INCLUDED + diff --git a/boost/type_traits/rank.hpp b/boost/type_traits/rank.hpp new file mode 100644 index 0000000..33f46c8 --- /dev/null +++ b/boost/type_traits/rank.hpp @@ -0,0 +1,89 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_RANK_HPP_INCLUDED +#define BOOST_TT_RANK_HPP_INCLUDED + +// should be the last #include +#include + +namespace boost { + +#if !defined( __CODEGEARC__ ) + +namespace detail{ + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = N); +}; +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +#endif +#endif +} + +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,__array_rank(T)) +#else +BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp::value)) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/reference_traits.hpp b/boost/type_traits/reference_traits.hpp new file mode 100644 index 0000000..1607b3d --- /dev/null +++ b/boost/type_traits/reference_traits.hpp @@ -0,0 +1,15 @@ +// (C) Copyright David Abrahams Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000-2002. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED +#define BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED + +#include + +#endif // BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/remove_all_extents.hpp b/boost/type_traits/remove_all_extents.hpp new file mode 100644 index 0000000..1409da1 --- /dev/null +++ b/boost/type_traits/remove_all_extents.hpp @@ -0,0 +1,40 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED +#define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED + +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_all_extents,T,T) + +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents::type type) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const volatile[],typename boost::remove_all_extents::type) +#endif +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/type_traits/remove_extent.hpp b/boost/type_traits/remove_extent.hpp new file mode 100644 index 0000000..9c4cdff --- /dev/null +++ b/boost/type_traits/remove_extent.hpp @@ -0,0 +1,40 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED +#define BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED + +#include +#include +#include + +// should be the last #include +#include + +namespace boost { + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_extent,T,T) + +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T[N],T type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const[N],T const type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T volatile[N],T volatile type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const volatile[N],T const volatile type) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T[],T) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const[],T const) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T volatile[],T volatile) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatile[],T const volatile) +#endif +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/type_traits/remove_volatile.hpp b/boost/type_traits/remove_volatile.hpp new file mode 100644 index 0000000..c202776 --- /dev/null +++ b/boost/type_traits/remove_volatile.hpp @@ -0,0 +1,77 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED +#define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED + +#include +#include +#include +#include + +#include + +// should be the last #include +#include + +namespace boost { + + +namespace detail { + +template +struct remove_volatile_helper +{ + typedef T type; +}; + +template +struct remove_volatile_helper +{ + typedef T const type; +}; + +template +struct remove_volatile_impl +{ + typedef typename remove_volatile_helper< + typename cv_traits_imp::unqualified_type + , ::boost::is_const::value + >::type type; +}; + +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct remove_volatile_impl +{ + typedef T&& type; +}; +#endif +} // namespace detail + +// * convert a type T to a non-volatile type - remove_volatile + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) +#endif + + +} // namespace boost + +#include + +#endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED diff --git a/boost/type_traits/same_traits.hpp b/boost/type_traits/same_traits.hpp new file mode 100644 index 0000000..dab7dac --- /dev/null +++ b/boost/type_traits/same_traits.hpp @@ -0,0 +1,15 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines is_same: + +#ifndef BOOST_TT_SAME_TRAITS_HPP_INCLUDED +#define BOOST_TT_SAME_TRAITS_HPP_INCLUDED + +#include + +#endif // BOOST_TT_SAME_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/transform_traits.hpp b/boost/type_traits/transform_traits.hpp new file mode 100644 index 0000000..7a82f1c --- /dev/null +++ b/boost/type_traits/transform_traits.hpp @@ -0,0 +1,21 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines traits classes for transforming one type to another: +// remove_reference, add_reference, remove_bounds, remove_pointer. +// + +#ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED +#define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED + +#include +#include +#include +#include +#include + +#endif // BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED diff --git a/boost/type_traits/transform_traits_spec.hpp b/boost/type_traits/transform_traits_spec.hpp new file mode 100644 index 0000000..b12b5f8 --- /dev/null +++ b/boost/type_traits/transform_traits_spec.hpp @@ -0,0 +1,14 @@ + +// Copyright 2001 Aleksey Gurtovoy. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED +#define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED + +#include + +#endif diff --git a/boost/type_traits/type_with_alignment.hpp b/boost/type_traits/type_with_alignment.hpp new file mode 100644 index 0000000..7eb66a7 --- /dev/null +++ b/boost/type_traits/type_with_alignment.hpp @@ -0,0 +1,357 @@ +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED +#define BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// should be the last #include +#include + +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4121) // alignment is sensitive to packing +#endif + +namespace boost { + +#ifndef __BORLANDC__ + +namespace detail { + +class alignment_dummy; +typedef void (*function_ptr)(); +typedef int (alignment_dummy::*member_ptr); +typedef int (alignment_dummy::*member_function_ptr)(); + +#ifdef BOOST_HAS_LONG_LONG +#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \ + 12, ( \ + char, short, int, long, ::boost::long_long_type, float, double, long double \ + , void*, function_ptr, member_ptr, member_function_ptr)) +#else +#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \ + 11, ( \ + char, short, int, long, float, double, long double \ + , void*, function_ptr, member_ptr, member_function_ptr)) +#endif + +#define BOOST_TT_HAS_ONE_T(D,Data,T) boost::detail::has_one_T< T > + +#define BOOST_TT_ALIGNMENT_STRUCT_TYPES \ + BOOST_PP_LIST_TRANSFORM(BOOST_TT_HAS_ONE_T, \ + X, \ + BOOST_TT_ALIGNMENT_BASE_TYPES) + +#define BOOST_TT_ALIGNMENT_TYPES \ + BOOST_PP_LIST_APPEND(BOOST_TT_ALIGNMENT_BASE_TYPES, \ + BOOST_TT_ALIGNMENT_STRUCT_TYPES) + +// +// lower_alignment_helper -- +// +// This template gets instantiated a lot, so use partial +// specialization when available to reduce the compiler burden. +// +template +struct lower_alignment_helper +{ + typedef char type; + enum { value = true }; +}; + +template +struct lower_alignment_helper +{ + enum { value = (alignment_of::value == target) }; + typedef typename mpl::if_c::type type; +}; + +#define BOOST_TT_CHOOSE_MIN_ALIGNMENT(R,P,I,T) \ + typename lower_alignment_helper< \ + BOOST_PP_CAT(found,I),target,T \ + >::type BOOST_PP_CAT(t,I); \ + enum { \ + BOOST_PP_CAT(found,BOOST_PP_INC(I)) \ + = lower_alignment_helper::value \ + }; + +#define BOOST_TT_CHOOSE_T(R,P,I,T) T BOOST_PP_CAT(t,I); + +template +struct has_one_T +{ + T data; +}; + +template +union lower_alignment +{ + enum { found0 = false }; + + BOOST_PP_LIST_FOR_EACH_I( + BOOST_TT_CHOOSE_MIN_ALIGNMENT + , ignored + , BOOST_TT_ALIGNMENT_TYPES + ) +}; + +union max_align +{ + BOOST_PP_LIST_FOR_EACH_I( + BOOST_TT_CHOOSE_T + , ignored + , BOOST_TT_ALIGNMENT_TYPES + ) +}; + +#undef BOOST_TT_ALIGNMENT_BASE_TYPES +#undef BOOST_TT_HAS_ONE_T +#undef BOOST_TT_ALIGNMENT_STRUCT_TYPES +#undef BOOST_TT_ALIGNMENT_TYPES +#undef BOOST_TT_CHOOSE_MIN_ALIGNMENT +#undef BOOST_TT_CHOOSE_T + +template +struct is_aligned +{ + BOOST_STATIC_CONSTANT(bool, + value = (TAlign >= Align) & (TAlign % Align == 0) + ); +}; + + +} // namespace detail + +template +struct is_pod< ::boost::detail::lower_alignment > +{ + BOOST_STATIC_CONSTANT(std::size_t, value = true); +}; + +// This alignment method originally due to Brian Parker, implemented by David +// Abrahams, and then ported here by Doug Gregor. +namespace detail{ + +template +class type_with_alignment_imp +{ + typedef ::boost::detail::lower_alignment t1; + typedef typename mpl::if_c< + ::boost::detail::is_aligned< ::boost::alignment_of::value,Align >::value + , t1 + , ::boost::detail::max_align + >::type align_t; + + BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of::value); + + BOOST_STATIC_ASSERT(found >= Align); + BOOST_STATIC_ASSERT(found % Align == 0); + + public: + typedef align_t type; +}; + +} + +template +class type_with_alignment + : public ::boost::detail::type_with_alignment_imp +{ +}; + +#if defined(__GNUC__) || (defined (__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) +namespace tt_align_ns { +struct __attribute__((__aligned__(2))) a2 {}; +struct __attribute__((__aligned__(4))) a4 {}; +struct __attribute__((__aligned__(8))) a8 {}; +struct __attribute__((__aligned__(16))) a16 {}; +struct __attribute__((__aligned__(32))) a32 {}; +struct __attribute__((__aligned__(64))) a64 {}; +struct __attribute__((__aligned__(128))) a128 {}; +} + +template<> class type_with_alignment<1> { public: typedef char type; }; +template<> class type_with_alignment<2> { public: typedef tt_align_ns::a2 type; }; +template<> class type_with_alignment<4> { public: typedef tt_align_ns::a4 type; }; +template<> class type_with_alignment<8> { public: typedef tt_align_ns::a8 type; }; +template<> class type_with_alignment<16> { public: typedef tt_align_ns::a16 type; }; +template<> class type_with_alignment<32> { public: typedef tt_align_ns::a32 type; }; +template<> class type_with_alignment<64> { public: typedef tt_align_ns::a64 type; }; +template<> class type_with_alignment<128> { public: typedef tt_align_ns::a128 type; }; + +namespace detail { +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true) +} +#endif +#if defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER)) +// +// MSVC supports types which have alignments greater than the normal +// maximum: these are used for example in the types __m64 and __m128 +// to provide types with alignment requirements which match the SSE +// registers. Therefore we extend type_with_alignment<> to support +// such types, however, we have to be careful to use a builtin type +// whenever possible otherwise we break previously working code: +// see http://article.gmane.org/gmane.comp.lib.boost.devel/173011 +// for an example and test case. Thus types like a8 below will +// be used *only* if the existing implementation can't provide a type +// with suitable alignment. This does mean however, that type_with_alignment<> +// may return a type which cannot be passed through a function call +// by value (and neither can any type containing such a type like +// Boost.Optional). However, this only happens when we have no choice +// in the matter because no other "ordinary" type is available. +// +namespace tt_align_ns { +struct __declspec(align(8)) a8 { + char m[8]; + typedef a8 type; +}; +struct __declspec(align(16)) a16 { + char m[16]; + typedef a16 type; +}; +struct __declspec(align(32)) a32 { + char m[32]; + typedef a32 type; +}; +struct __declspec(align(64)) a64 +{ + char m[64]; + typedef a64 type; +}; +struct __declspec(align(128)) a128 { + char m[128]; + typedef a128 type; +}; +} + +template<> class type_with_alignment<8> +{ + typedef mpl::if_c< + ::boost::alignment_of::value < 8, + tt_align_ns::a8, + boost::detail::type_with_alignment_imp<8> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<16> +{ + typedef mpl::if_c< + ::boost::alignment_of::value < 16, + tt_align_ns::a16, + boost::detail::type_with_alignment_imp<16> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<32> +{ + typedef mpl::if_c< + ::boost::alignment_of::value < 32, + tt_align_ns::a32, + boost::detail::type_with_alignment_imp<32> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<64> { + typedef mpl::if_c< + ::boost::alignment_of::value < 64, + tt_align_ns::a64, + boost::detail::type_with_alignment_imp<64> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<128> { + typedef mpl::if_c< + ::boost::alignment_of::value < 128, + tt_align_ns::a128, + boost::detail::type_with_alignment_imp<128> >::type t1; +public: + typedef t1::type type; +}; + +namespace detail { +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true) +} +#endif + +#else + +// +// Borland specific version, we have this for two reasons: +// 1) The version above doesn't always compile (with the new test cases for example) +// 2) Because of Borlands #pragma option we can create types with alignments that are +// greater that the largest aligned builtin type. + +namespace tt_align_ns{ +#pragma option push -a16 +struct a2{ short s; }; +struct a4{ int s; }; +struct a8{ double s; }; +struct a16{ long double s; }; +#pragma option pop +} + +namespace detail { + +typedef ::boost::tt_align_ns::a16 max_align; + +//#if ! BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) +//#endif +} + +template struct type_with_alignment +{ + // We should never get to here, but if we do use the maximally + // aligned type: + // BOOST_STATIC_ASSERT(0); + typedef tt_align_ns::a16 type; +}; +template <> struct type_with_alignment<1>{ typedef char type; }; +template <> struct type_with_alignment<2>{ typedef tt_align_ns::a2 type; }; +template <> struct type_with_alignment<4>{ typedef tt_align_ns::a4 type; }; +template <> struct type_with_alignment<8>{ typedef tt_align_ns::a8 type; }; +template <> struct type_with_alignment<16>{ typedef tt_align_ns::a16 type; }; + +#endif + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#include + +#endif // BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED + + diff --git a/boost/utility/compare_pointees.hpp b/boost/utility/compare_pointees.hpp new file mode 100644 index 0000000..7e2515c --- /dev/null +++ b/boost/utility/compare_pointees.hpp @@ -0,0 +1,68 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// 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) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_UTILITY_COMPARE_POINTEES_25AGO2003_HPP +#define BOOST_UTILITY_COMPARE_POINTEES_25AGO2003_HPP + +#include + +namespace boost { + +// template bool equal_pointees(OP const& x, OP const& y); +// template struct equal_pointees_t; +// +// Being OP a model of OptionalPointee (either a pointer or an optional): +// +// If both x and y have valid pointees, returns the result of (*x == *y) +// If only one has a valid pointee, returns false. +// If none have valid pointees, returns true. +// No-throw +template +inline +bool equal_pointees ( OptionalPointee const& x, OptionalPointee const& y ) +{ + return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ; +} + +template +struct equal_pointees_t : std::binary_function +{ + bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const + { return equal_pointees(x,y) ; } +} ; + +// template bool less_pointees(OP const& x, OP const& y); +// template struct less_pointees_t; +// +// Being OP a model of OptionalPointee (either a pointer or an optional): +// +// If y has not a valid pointee, returns false. +// ElseIf x has not a valid pointee, returns true. +// ElseIf both x and y have valid pointees, returns the result of (*x < *y) +// No-throw +template +inline +bool less_pointees ( OptionalPointee const& x, OptionalPointee const& y ) +{ + return !y ? false : ( !x ? true : (*x) < (*y) ) ; +} + +template +struct less_pointees_t : std::binary_function +{ + bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const + { return less_pointees(x,y) ; } +} ; + +} // namespace boost + +#endif + diff --git a/build.cmd b/build.cmd index 747a3aa..bf5568f 100644 --- a/build.cmd +++ b/build.cmd @@ -6,4 +6,5 @@ bcp ^ boost/range/algorithm/ ^ boost/range/algorithm_ext/ ^ boost/smart_ptr/intrusive_ptr.hpp ^ + boost/optional.hpp ^ --boost="%BOOST_PATH%" .