2
0
mirror of https://github.com/boostorg/variant.git synced 2026-01-19 04:42:16 +00:00

Removed NO_VOID_RETURNS workaround

The workaround is obsolete, from Boost.Config it looks like it was used for
very old EDG2.4, VC6, and other compilers in VC6 emulation mode.
This commit is contained in:
Nikita Kniazev
2019-01-06 00:37:32 +03:00
parent a0ad527fce
commit c4370b2da2
10 changed files with 60 additions and 332 deletions

View File

@@ -15,7 +15,6 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/variant/detail/apply_visitor_unary.hpp>
@@ -75,14 +74,14 @@ public: // visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Value2>
typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value, result_type>::type
operator()(Value2&& value2)
{
return visitor_(::boost::move(value1_), ::boost::forward<Value2>(value2));
}
template <typename Value2>
typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value, result_type>::type
operator()(Value2&& value2)
{
return visitor_(value1_, ::boost::forward<Value2>(value2));
@@ -91,7 +90,7 @@ public: // visitor interfaces
#else
template <typename Value2>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
result_type
operator()(Value2& value2)
{
return visitor_(value1_, value2);
@@ -129,7 +128,7 @@ public: // visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Value1>
typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value, result_type>::type
operator()(Value1&& value1)
{
apply_visitor_binary_invoke<
@@ -142,7 +141,7 @@ public: // visitor interfaces
}
template <typename Value1>
typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value, result_type>::type
operator()(Value1&& value1)
{
apply_visitor_binary_invoke<
@@ -157,7 +156,7 @@ public: // visitor interfaces
#else
template <typename Value1>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
result_type
operator()(Value1& value1)
{
apply_visitor_binary_invoke<
@@ -185,7 +184,7 @@ private:
#if !BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302))
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
typename V::result_type \
/**/
#else // EDG-based compilers
@@ -193,7 +192,7 @@ private:
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
typename enable_if< \
mpl::not_< is_const< V > > \
, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
, typename V::result_type \
>::type \
/**/
@@ -238,10 +237,7 @@ apply_visitor( Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2)
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable1, typename Visitable2>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
inline typename Visitor::result_type
apply_visitor( const Visitor& visitor , Visitable1&& visitable1 , Visitable2&& visitable2)
{
::boost::detail::variant::apply_visitor_binary_unwrap<
@@ -254,10 +250,7 @@ apply_visitor( const Visitor& visitor , Visitable1&& visitable1 , Visitable2&& v
#else
template <typename Visitor, typename Visitable1, typename Visitable2>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
inline typename Visitor::result_type
apply_visitor( const Visitor& visitor , Visitable1& visitable1 , Visitable2& visitable2)
{
::boost::detail::variant::apply_visitor_binary_unwrap<

View File

@@ -13,8 +13,6 @@
#ifndef BOOST_VARIANT_DETAIL_APPLY_VISITOR_DELAYED_HPP
#define BOOST_VARIANT_DETAIL_APPLY_VISITOR_DELAYED_HPP
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/variant/detail/apply_visitor_unary.hpp>
#include <boost/variant/detail/apply_visitor_binary.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
@@ -63,8 +61,7 @@ public: // structors
public: // N-ary visitor interface
template <typename... Visitables>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
operator()(Visitables&... visitables) const
result_type operator()(Visitables&... visitables) const
{
return apply_visitor(visitor_, visitables...);
}
@@ -74,8 +71,7 @@ public: // N-ary visitor interface
public: // unary visitor interface
template <typename Visitable>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
operator()(Visitable& visitable) const
result_type operator()(Visitable& visitable) const
{
return apply_visitor(visitor_, visitable);
}
@@ -83,8 +79,7 @@ public: // unary visitor interface
public: // binary visitor interface
template <typename Visitable1, typename Visitable2>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
operator()(Visitable1& visitable1, Visitable2& visitable2) const
result_type operator()(Visitable1& visitable1, Visitable2& visitable2) const
{
return apply_visitor(visitor_, visitable1, visitable2);
}

View File

@@ -15,7 +15,6 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/move/utility.hpp>
#if BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302))
@@ -50,7 +49,7 @@ namespace boost {
#if !BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302))
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
typename V::result_type \
/**/
#else // EDG-based compilers
@@ -58,7 +57,7 @@ namespace boost {
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
typename enable_if< \
mpl::not_< is_const< V > > \
, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
, typename V::result_type \
>::type \
/**/
@@ -90,16 +89,14 @@ apply_visitor(Visitor& visitor, Visitable& visitable)
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
apply_visitor(const Visitor& visitor, Visitable&& visitable)
{
return ::boost::forward<Visitable>(visitable).apply_visitor(visitor);
}
#else
template <typename Visitor, typename Visitable>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
apply_visitor(const Visitor& visitor, Visitable& visitable)
{
return visitable.apply_visitor(visitor);

View File

@@ -14,7 +14,6 @@
#define BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP
#include <boost/config.hpp>
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/assert.hpp>
#include <cstdlib> // std::abort
@@ -39,8 +38,7 @@ BOOST_NORETURN inline void forced_return_no_return() { // fixes `must return a v
// compile-time requirement of returning a result value.
//
template <typename T>
BOOST_NORETURN inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T)
BOOST_NORETURN inline T
forced_return()
{
// logical error: should never be here! (see above)
@@ -49,7 +47,7 @@ forced_return()
forced_return_no_return();
#ifdef BOOST_NO_NORETURN
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) (*dummy)() = 0;
T (*dummy)() = 0;
return dummy();
#endif
}

View File

@@ -1,88 +0,0 @@
//-----------------------------------------------------------------------------
// boost variant/detail/generic_result_type.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_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
#define BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
#include <boost/config.hpp>
//////////////////////////////////////////////////////////////////////////
// (workaround) macro BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE
//
// On compilers with BOOST_NO_VOID_RETURNS, this macro provides a route
// to a single syntax for dealing with template functions that may (but
// not necessarily) return nothing (i.e. void).
//
// BOOST_VARIANT_AUX_RETURN_VOID provided for compilers w/ (erroneous?)
// warnings about non-void functions not returning a value.
//
#if !defined(BOOST_NO_VOID_RETURNS)
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
T \
/**/
#define BOOST_VARIANT_AUX_RETURN_VOID \
/**/
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
void \
/**/
#else // defined(BOOST_NO_VOID_RETURNS)
namespace boost {
namespace detail { namespace variant {
struct fake_return_void
{
fake_return_void()
{
}
template <typename T>
fake_return_void(const T&)
{
}
};
template <typename T>
struct no_void_returns_helper
{
typedef T type;
};
template <>
struct no_void_returns_helper<void>
{
typedef fake_return_void type;
};
}} // namespace detail::variant
} // namespace boost
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
BOOST_DEDUCED_TYPENAME \
::boost::detail::variant::no_void_returns_helper< T >::type \
/**/
#define BOOST_VARIANT_AUX_RETURN_VOID \
return ::boost::detail::variant::fake_return_void() \
/**/
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
::boost::detail::variant::fake_return_void
#endif // BOOST_NO_VOID_RETURNS workaround
#endif // BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP

View File

@@ -126,7 +126,7 @@ namespace detail { namespace variant {
typedef typename Visitor::result_type result_type;
template <typename Value>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) operator()(Value&& value) const
result_type operator()(Value&& value) const
{
return ::boost::apply_visitor(
make_one_by_one_visitor_and_value_referer(
@@ -159,12 +159,12 @@ namespace detail { namespace variant {
typedef typename Visitor::result_type result_type;
template <class Tuple, std::size_t... I>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) do_call(Tuple t, index_sequence<I...>) const {
result_type do_call(Tuple t, index_sequence<I...>) const {
return visitor_(unwrap(std::get<I>(t))...);
}
template <typename Value>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) operator()(Value&& value) const
result_type operator()(Value&& value) const
{
return do_call(
std::tuple_cat(values_, std::make_tuple(wrap<Value, ! ::boost::is_lvalue_reference<Value>::value>(value))),
@@ -176,7 +176,7 @@ namespace detail { namespace variant {
}} // namespace detail::variant
template <class Visitor, class T1, class T2, class T3, class... TN>
inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
apply_visitor(const Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn)
{
return ::boost::apply_visitor(
@@ -194,7 +194,7 @@ namespace detail { namespace variant {
}
template <class Visitor, class T1, class T2, class T3, class... TN>
inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
apply_visitor(Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn)
{
return ::boost::apply_visitor(

View File

@@ -67,7 +67,7 @@ namespace detail { namespace variant {
#define BOOST_VARIANT_VISIT(z, n, data) \
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n, 1), class VisitableUnwrapped)> \
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) operator()( \
result_type operator()( \
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ADD(n, 1), VisitableUnwrapped, & vis) \
) const \
{ \
@@ -119,7 +119,7 @@ BOOST_PP_REPEAT( BOOST_PP_SUB(BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS, 2), BOOST_V
#define BOOST_VARIANT_VISIT(z, n, data) \
template <class Visitor BOOST_PP_COMMA() BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n, 3), class T)> \
inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(BOOST_DEDUCED_TYPENAME Visitor::result_type) apply_visitor( \
inline BOOST_DEDUCED_TYPENAME Visitor::result_type apply_visitor( \
data BOOST_PP_COMMA() BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ADD(n, 3), T, & var) \
) \
{ \

View File

@@ -18,7 +18,6 @@
#include <boost/variant/detail/backup_holder.hpp>
#include <boost/variant/detail/cast_storage.hpp>
#include <boost/variant/detail/forced_return.hpp>
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/mpl/eval_if.hpp>
@@ -102,8 +101,7 @@ struct visitation_impl_step< LastIter,LastIter >
//
template <typename Visitor, typename VoidPtrCV, typename T>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl_invoke_impl(
int, Visitor& visitor, VoidPtrCV storage, T*
, mpl::true_// never_uses_backup
@@ -115,8 +113,7 @@ visitation_impl_invoke_impl(
}
template <typename Visitor, typename VoidPtrCV, typename T>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl_invoke_impl(
int internal_which, Visitor& visitor, VoidPtrCV storage, T*
, mpl::false_// never_uses_backup
@@ -137,8 +134,7 @@ visitation_impl_invoke_impl(
}
template <typename Visitor, typename VoidPtrCV, typename T, typename NoBackupFlag>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl_invoke(
int internal_which, Visitor& visitor, VoidPtrCV storage, T* t
, NoBackupFlag
@@ -158,8 +154,7 @@ visitation_impl_invoke(
}
template <typename Visitor, typename VoidPtrCV, typename NBF>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl_invoke(int, Visitor&, VoidPtrCV, apply_visitor_unrolled*, NBF, long)
{
// should never be here at runtime!
@@ -178,8 +173,7 @@ template <
, typename Visitor, typename VPCV
, typename NBF
>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl(
int, int, Visitor&, VPCV
, mpl::true_ // is_apply_visitor_unrolled
@@ -196,8 +190,7 @@ template <
, typename Visitor, typename VoidPtrCV
, typename NoBackupFlag
>
inline
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type)
inline typename Visitor::result_type
visitation_impl(
const int internal_which, const int logical_which
, Visitor& visitor, VoidPtrCV storage

View File

@@ -33,7 +33,6 @@
#include <boost/variant/detail/visitation_impl.hpp>
#include <boost/variant/detail/hash_variant.hpp>
#include <boost/variant/detail/generic_result_type.hpp>
#include <boost/variant/detail/move.hpp>
#include <boost/detail/no_exceptions_support.hpp>
@@ -381,8 +380,7 @@ struct destroyer
public: // visitor interfaces
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(T& operand, int) const BOOST_NOEXCEPT
void internal_visit(T& operand, int) const BOOST_NOEXCEPT
{
operand.~T(); // must be noexcept
@@ -390,8 +388,6 @@ public: // visitor interfaces
BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
(void)operand; // suppresses warnings
#endif
BOOST_VARIANT_AUX_RETURN_VOID;
}
};
@@ -445,27 +441,21 @@ public: // structors
public: // internal visitor interface
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
void internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
{
new(storage_) T( operand.get() );
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const
void internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const
{
new(storage_) T( operand.get() );
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(const T& operand, int) const
void internal_visit(const T& operand, int) const
{
new(storage_) T(operand);
BOOST_VARIANT_AUX_RETURN_VOID;
}
};
@@ -493,19 +483,15 @@ public: // structors
public: // internal visitor interface
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
void internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
{
new(storage_) T( ::boost::detail::variant::move(operand.get()) );
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(T& operand, int) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(T(boost::declval<T>())))
void internal_visit(T& operand, int) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(T(boost::declval<T>())))
{
new(storage_) T(::boost::detail::variant::move(operand));
BOOST_VARIANT_AUX_RETURN_VOID;
}
};
#endif
@@ -533,26 +519,21 @@ public: // structors
public: // internal visitor interfaces
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(backup_holder<T>& lhs_content, long) const
void internal_visit(backup_holder<T>& lhs_content, long) const
{
lhs_content.get()
= static_cast< const backup_holder<T>* >(rhs_storage_)->get();
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(const backup_holder<T>& lhs_content, long) const
void internal_visit(const backup_holder<T>& lhs_content, long) const
{
lhs_content.get()
= static_cast< const backup_holder<T>* >(rhs_storage_)->get();
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(T& lhs_content, int) const
void internal_visit(T& lhs_content, int) const
{
// NOTE TO USER :
// Compile error here indicates one of variant's bounded types does
@@ -562,7 +543,6 @@ public: // internal visitor interfaces
// Hint: Are any of the bounded types const-qualified or references?
//
lhs_content = *static_cast< const T* >(rhs_storage_);
BOOST_VARIANT_AUX_RETURN_VOID;
}
};
@@ -590,26 +570,21 @@ public: // structors
public: // internal visitor interfaces
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(backup_holder<T>& lhs_content, long) const
void internal_visit(backup_holder<T>& lhs_content, long) const
{
lhs_content.get()
= ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get());
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(const backup_holder<T>& lhs_content, long) const
void internal_visit(const backup_holder<T>& lhs_content, long) const
{
lhs_content.get()
= ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get());
BOOST_VARIANT_AUX_RETURN_VOID;
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(T& lhs_content, int) const
void internal_visit(T& lhs_content, int) const
{
// NOTE TO USER :
// Compile error here indicates one of variant's bounded types does
@@ -619,7 +594,6 @@ public: // internal visitor interfaces
// Hint: Are any of the bounded types const-qualified or references?
//
lhs_content = ::boost::detail::variant::move(*static_cast<T* >(rhs_storage_));
BOOST_VARIANT_AUX_RETURN_VOID;
}
};
@@ -866,15 +840,12 @@ private: // helpers, for visitor interface (below)
public: // visitor interface
template <typename LhsT>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(LhsT& lhs_content, int)
void internal_visit(LhsT& lhs_content, int)
{
typedef typename is_nothrow_move_constructible<LhsT>::type
nothrow_move;
backup_assign_impl( lhs_content, nothrow_move(), 1L);
BOOST_VARIANT_AUX_RETURN_VOID;
}
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -1038,8 +1009,6 @@ public: // structors
{
}
#if !defined(BOOST_NO_VOID_RETURNS)
public: // internal visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
@@ -1076,119 +1045,40 @@ public: // internal visitor interfaces
#endif //RVALUE REFERENCES
#else // defined(BOOST_NO_VOID_RETURNS)
private: // helpers, for internal visitor interfaces (below)
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
template <typename T>
typename enable_if<mpl::and_<MoveSemantics && is_same<T, T>::value>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
visit_impl(T&& operand, mpl::false_)
{
return visitor_(::boost::move(operand));
}
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
template <typename T>
typename enable_if_c<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type
visit_impl(T&& operand, mpl::true_)
{
visitor_(::boost::move(operand));
BOOST_VARIANT_AUX_RETURN_VOID;
}
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
template <typename T>
typename disable_if_c<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
visit_impl(T&& operand, mpl::false_)
{
return visitor_(operand);
}
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
template <typename T>
typename disable_if<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type
visit_impl(T&& operand, mpl::true_)
{
visitor_(operand);
BOOST_VARIANT_AUX_RETURN_VOID;
}
#else
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
visit_impl(T& operand, mpl::false_)
{
return visitor_(operand);
}
template <typename T>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
visit_impl(T& operand, mpl::true_)
{
visitor_(operand);
BOOST_VARIANT_AUX_RETURN_VOID;
}
#endif //RVALUE_REFERENCES
public: // internal visitor interfaces
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(T& operand, int)
{
typedef typename is_same<result_type, void>::type
has_void_result_type;
return visit_impl(operand, has_void_result_type());
}
#endif // BOOST_NO_VOID_RETURNS) workaround
public: // internal visitor interfaces, cont.
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(boost::recursive_wrapper<T>& operand, long)
result_type internal_visit(boost::recursive_wrapper<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(const boost::recursive_wrapper<T>& operand, long)
result_type internal_visit(const boost::recursive_wrapper<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(boost::detail::reference_content<T>& operand, long)
result_type internal_visit(boost::detail::reference_content<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(const boost::detail::reference_content<T>& operand, long)
result_type internal_visit(const boost::detail::reference_content<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(boost::detail::variant::backup_holder<T>& operand, long)
result_type internal_visit(boost::detail::variant::backup_holder<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
template <typename T>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
internal_visit(const boost::detail::variant::backup_holder<T>& operand, long)
result_type internal_visit(const boost::detail::variant::backup_holder<T>& operand, long)
{
return internal_visit( operand.get(), 1L );
}
@@ -2013,8 +1903,7 @@ private: // helpers, for modifiers (below)
public: // internal visitor interfaces
template <typename RhsT>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(const RhsT& rhs_content, int) const
void internal_visit(const RhsT& rhs_content, int) const
{
typedef typename has_nothrow_copy<RhsT>::type
nothrow_copy;
@@ -2029,8 +1918,6 @@ private: // helpers, for modifiers (below)
, nothrow_move_constructor()
, has_fallback_type_()
);
BOOST_VARIANT_AUX_RETURN_VOID;
}
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -2135,8 +2022,7 @@ private: // helpers, for modifiers (below)
public: // internal visitor interfaces
template <typename RhsT>
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
internal_visit(RhsT& rhs_content, int) const
void internal_visit(RhsT& rhs_content, int) const
{
typedef typename is_nothrow_move_constructible<RhsT>::type
nothrow_move_constructor;
@@ -2151,8 +2037,6 @@ private: // helpers, for modifiers (below)
, nothrow_move_constructor()
, has_fallback_type_()
);
BOOST_VARIANT_AUX_RETURN_VOID;
}
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -2430,10 +2314,7 @@ public:
#endif// !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Visitor, typename VoidPtrCV>
static
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
static typename Visitor::result_type
internal_apply_visitor_impl(
int internal_which
, int logical_which
@@ -2458,9 +2339,7 @@ public:
}
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
internal_apply_visitor(Visitor& visitor)
{
return internal_apply_visitor_impl(
@@ -2469,9 +2348,7 @@ public:
}
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
internal_apply_visitor(Visitor& visitor) const
{
return internal_apply_visitor_impl(
@@ -2484,9 +2361,7 @@ public: // visitation support
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
apply_visitor(Visitor& visitor) &&
{
detail::variant::invoke_visitor<Visitor, true> invoker(visitor);
@@ -2494,9 +2369,7 @@ public: // visitation support
}
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
apply_visitor(Visitor& visitor) const&&
{
detail::variant::invoke_visitor<Visitor, true> invoker(visitor);
@@ -2506,9 +2379,7 @@ public: // visitation support
#endif
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
apply_visitor(Visitor& visitor)
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
&
@@ -2519,9 +2390,7 @@ public: // visitation support
}
template <typename Visitor>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
typename Visitor::result_type
)
typename Visitor::result_type
apply_visitor(Visitor& visitor) const
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
&

View File

@@ -68,8 +68,6 @@ public: // static visitor interfaces
boost::throw_exception(bad_visit());
}
#if !defined(BOOST_NO_VOID_RETURNS)
public: // static visitor interfaces, cont.
result_type operator()(argument_fwd_type operand) const
@@ -77,33 +75,6 @@ public: // static visitor interfaces, cont.
return visitor_(operand);
}
#else // defined(BOOST_NO_VOID_RETURNS)
private: // helpers, for static visitor interfaces (below)
result_type execute_impl(argument_fwd_type operand, mpl::false_) const
{
return visitor_(operand);
}
BOOST_VARIANT_AUX_RETURN_VOID_TYPE
execute_impl(argument_fwd_type operand, mpl::true_) const
{
visitor_(operand);
BOOST_VARIANT_AUX_RETURN_VOID;
}
public: // static visitor interfaces, cont.
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
operator()(argument_fwd_type operand) const
{
typedef typename is_void<result_type>::type has_void_result;
return execute_impl(operand, has_void_result());
}
#endif // BOOST_NO_VOID_RETURNS workaround
};
template <typename R, typename T>