mirror of
https://github.com/boostorg/variant.git
synced 2026-07-21 13:43:36 +00:00
Apply naming recomendations from mailing list discussion: unsafe=>relaxed, safe=>strict
This commit is contained in:
+10
-10
@@ -26,7 +26,7 @@
|
||||
</method>
|
||||
</class>
|
||||
|
||||
<overloaded-function name="unsafe_get">
|
||||
<overloaded-function name="relaxed_get">
|
||||
<signature>
|
||||
<template>
|
||||
<template-type-parameter name="U"/>
|
||||
@@ -94,7 +94,7 @@
|
||||
<purpose>
|
||||
<simpara>Retrieves a value of a specified type from a given
|
||||
<code><classname>variant</classname></code>. </simpara>
|
||||
<simpara>Unlike <functionname>safe_get</functionname> does not assert at compile time
|
||||
<simpara>Unlike <functionname>strict_get</functionname> does not assert at compile time
|
||||
that type <code>U</code> is one of the types that can be stored in variant.</simpara>
|
||||
</purpose>
|
||||
|
||||
@@ -105,8 +105,8 @@
|
||||
only if the content is of the specified type <code>U</code>, with
|
||||
failure indicated as described below.</simpara>
|
||||
<simpara><emphasis role="bold">Recomendation</emphasis>: Use
|
||||
<functionname>get</functionname> or <functionname>safe_get</functionname> in new code.
|
||||
<functionname>safe_get</functionname>
|
||||
<functionname>get</functionname> or <functionname>strict_get</functionname> in new code.
|
||||
<functionname>strict_get</functionname>
|
||||
provides more compile time checks and it's behavior is closer to <code>std::get</code>
|
||||
from C++ Standard Library.</simpara>
|
||||
<simpara><emphasis role="bold">Warning</emphasis>: After either
|
||||
@@ -155,7 +155,7 @@
|
||||
</rationale>
|
||||
</overloaded-function>
|
||||
|
||||
<overloaded-function name="safe_get">
|
||||
<overloaded-function name="strict_get">
|
||||
<signature>
|
||||
<template>
|
||||
<template-type-parameter name="U"/>
|
||||
@@ -226,7 +226,7 @@
|
||||
</purpose>
|
||||
|
||||
<description>
|
||||
<simpara>Acts exactly like <functionname>unsafe_get</functionname> but does a compile time check
|
||||
<simpara>Acts exactly like <functionname>relaxed_get</functionname> but does a compile time check
|
||||
that type <code>U</code> is one of the types that can be stored in variant.</simpara>
|
||||
</description>
|
||||
</overloaded-function>
|
||||
@@ -302,13 +302,13 @@
|
||||
</purpose>
|
||||
|
||||
<description>
|
||||
<simpara>Evaluates to <functionname>safe_get</functionname> if <code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>
|
||||
is not defined. If <code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>
|
||||
is defined then evaluates to <functionname>safe_get</functionname>. </simpara>
|
||||
<simpara>Evaluates to <functionname>strict_get</functionname> if <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>
|
||||
is not defined. If <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>
|
||||
is defined then evaluates to <functionname>strict_get</functionname>. </simpara>
|
||||
|
||||
<simpara><emphasis role="bold">Recomendation</emphasis>: Use
|
||||
<functionname>get</functionname> in new code without defining
|
||||
<code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>. In that way <functionname>get</functionname>
|
||||
<code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>. In that way <functionname>get</functionname>
|
||||
provides more compile time checks and it's behavior is closer to <code>std::get</code>
|
||||
from C++ Standard Library.</simpara>
|
||||
</description>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</method>
|
||||
</class>
|
||||
|
||||
<overloaded-function name="polymorphic_unsafe_get">
|
||||
<overloaded-function name="polymorphic_relaxed_get">
|
||||
<signature>
|
||||
<template>
|
||||
<template-type-parameter name="U"/>
|
||||
@@ -94,7 +94,7 @@
|
||||
<purpose>
|
||||
<simpara>Retrieves a value of a specified type from a given
|
||||
<code><classname>variant</classname></code>.</simpara>
|
||||
<simpara>Unlike <functionname>polymorphic_safe_get</functionname> does not assert at compile time
|
||||
<simpara>Unlike <functionname>polymorphic_strict_get</functionname> does not assert at compile time
|
||||
that type <code>U</code> is one of the types that can be stored in variant.</simpara>
|
||||
</purpose>
|
||||
|
||||
@@ -106,9 +106,9 @@
|
||||
derived from type <code>U</code>, with
|
||||
failure indicated as described below.</simpara>
|
||||
<simpara><emphasis role="bold">Recomendation</emphasis>: Use
|
||||
<functionname>polymorphic_get</functionname> or <functionname>polymorphic_safe_get</functionname>
|
||||
<functionname>polymorphic_get</functionname> or <functionname>polymorphic_strict_get</functionname>
|
||||
in new code.
|
||||
<functionname>polymorphic_safe_get</functionname>
|
||||
<functionname>polymorphic_strict_get</functionname>
|
||||
provides more compile time checks and it's behavior is closer to <code>std::get</code>
|
||||
from C++ Standard Library.</simpara>
|
||||
<simpara><emphasis role="bold">Warning</emphasis>: After either
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
|
||||
|
||||
<overloaded-function name="polymorphic_safe_get">
|
||||
<overloaded-function name="polymorphic_strict_get">
|
||||
<signature>
|
||||
<template>
|
||||
<template-type-parameter name="U"/>
|
||||
@@ -233,7 +233,7 @@
|
||||
</purpose>
|
||||
|
||||
<description>
|
||||
<simpara>Acts exactly like <functionname>polymorphic_unsafe_get</functionname> but does a compile time check
|
||||
<simpara>Acts exactly like <functionname>polymorphic_relaxed_get</functionname> but does a compile time check
|
||||
that type <code>U</code> is one of the types that can be stored in variant.</simpara>
|
||||
</description>
|
||||
</overloaded-function>
|
||||
@@ -309,14 +309,14 @@
|
||||
</purpose>
|
||||
|
||||
<description>
|
||||
<simpara>Evaluates to <functionname>polymorphic_safe_get</functionname>
|
||||
if <code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>
|
||||
is not defined. If <code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>
|
||||
is defined then evaluates to <functionname>polymorphic_safe_get</functionname>. </simpara>
|
||||
<simpara>Evaluates to <functionname>polymorphic_strict_get</functionname>
|
||||
if <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>
|
||||
is not defined. If <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>
|
||||
is defined then evaluates to <functionname>polymorphic_strict_get</functionname>. </simpara>
|
||||
|
||||
<simpara><emphasis role="bold">Recomendation</emphasis>: Use
|
||||
<functionname>polymorphic_get</functionname> in new code without defining
|
||||
<code>BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT</code>. In that way
|
||||
<code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>. In that way
|
||||
<functionname>polymorphic_get</functionname>
|
||||
provides more compile time checks and it's behavior is closer to <code>std::get</code>
|
||||
from C++ Standard Library.</simpara>
|
||||
|
||||
@@ -97,12 +97,12 @@ public: // visitor interfaces
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// unsafe_get<U>(variant) methods
|
||||
// relaxed_get<U>(variant) methods
|
||||
//
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<U>::type
|
||||
unsafe_get(
|
||||
relaxed_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -117,7 +117,7 @@ unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<const U>::type
|
||||
unsafe_get(
|
||||
relaxed_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -132,13 +132,13 @@ unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<U>::type
|
||||
unsafe_get(
|
||||
relaxed_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
typedef typename add_pointer<U>::type U_ptr;
|
||||
U_ptr result = unsafe_get<U>(&operand);
|
||||
U_ptr result = relaxed_get<U>(&operand);
|
||||
|
||||
if (!result)
|
||||
boost::throw_exception(bad_get());
|
||||
@@ -148,13 +148,13 @@ unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<const U>::type
|
||||
unsafe_get(
|
||||
relaxed_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
typedef typename add_pointer<const U>::type U_ptr;
|
||||
U_ptr result = unsafe_get<const U>(&operand);
|
||||
U_ptr result = relaxed_get<const U>(&operand);
|
||||
|
||||
if (!result)
|
||||
boost::throw_exception(bad_get());
|
||||
@@ -164,12 +164,12 @@ unsafe_get(
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// safe_get<U>(variant) methods
|
||||
// strict_get<U>(variant) methods
|
||||
//
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<U>::type
|
||||
safe_get(
|
||||
strict_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -180,13 +180,13 @@ safe_get(
|
||||
"call to boost::get<U>(boost::variant<T...>*) will always return NULL"
|
||||
);
|
||||
|
||||
return unsafe_get<U>(operand);
|
||||
return relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<const U>::type
|
||||
safe_get(
|
||||
strict_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -197,13 +197,13 @@ safe_get(
|
||||
"call to boost::get<U>(const boost::variant<T...>*) will always return NULL"
|
||||
);
|
||||
|
||||
return unsafe_get<U>(operand);
|
||||
return relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<U>::type
|
||||
safe_get(
|
||||
strict_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
@@ -214,13 +214,13 @@ safe_get(
|
||||
"call to boost::get<U>(boost::variant<T...>&) will always throw boost::bad_get exception"
|
||||
);
|
||||
|
||||
return unsafe_get<U>(operand);
|
||||
return relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<const U>::type
|
||||
safe_get(
|
||||
strict_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
@@ -231,7 +231,7 @@ safe_get(
|
||||
"call to boost::get<U>(const boost::variant<T...>&) will always throw boost::bad_get exception"
|
||||
);
|
||||
|
||||
return unsafe_get<U>(operand);
|
||||
return relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -246,10 +246,10 @@ get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return relaxed_get<U>(operand);
|
||||
#else
|
||||
return safe_get<U>(operand);
|
||||
return strict_get<U>(operand);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -262,10 +262,10 @@ get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return relaxed_get<U>(operand);
|
||||
#else
|
||||
return safe_get<U>(operand);
|
||||
return strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -277,10 +277,10 @@ get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return relaxed_get<U>(operand);
|
||||
#else
|
||||
return safe_get<U>(operand);
|
||||
return strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -292,10 +292,10 @@ get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return relaxed_get<U>(operand);
|
||||
#else
|
||||
return safe_get<U>(operand);
|
||||
return strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -137,13 +137,13 @@ public: // visitor interfaces
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// polymorphic_unsafe_get
|
||||
// polymorphic_relaxed_get
|
||||
//
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<U>::type
|
||||
polymorphic_unsafe_get(
|
||||
polymorphic_relaxed_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -158,7 +158,7 @@ polymorphic_unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<const U>::type
|
||||
polymorphic_unsafe_get(
|
||||
polymorphic_relaxed_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -173,13 +173,13 @@ polymorphic_unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<U>::type
|
||||
polymorphic_unsafe_get(
|
||||
polymorphic_relaxed_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
typedef typename add_pointer<U>::type U_ptr;
|
||||
U_ptr result = polymorphic_unsafe_get<U>(&operand);
|
||||
U_ptr result = polymorphic_relaxed_get<U>(&operand);
|
||||
|
||||
if (!result)
|
||||
boost::throw_exception(bad_polymorphic_get());
|
||||
@@ -189,13 +189,13 @@ polymorphic_unsafe_get(
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<const U>::type
|
||||
polymorphic_unsafe_get(
|
||||
polymorphic_relaxed_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
typedef typename add_pointer<const U>::type U_ptr;
|
||||
U_ptr result = polymorphic_unsafe_get<const U>(&operand);
|
||||
U_ptr result = polymorphic_relaxed_get<const U>(&operand);
|
||||
|
||||
if (!result)
|
||||
boost::throw_exception(bad_polymorphic_get());
|
||||
@@ -203,13 +203,13 @@ polymorphic_unsafe_get(
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// polymorphic_safe_get
|
||||
// polymorphic_strict_get
|
||||
//
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<U>::type
|
||||
polymorphic_safe_get(
|
||||
polymorphic_strict_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -220,13 +220,13 @@ polymorphic_safe_get(
|
||||
"call to boost::polymorphic_get<U>(boost::variant<T...>*) will always return NULL"
|
||||
);
|
||||
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_pointer<const U>::type
|
||||
polymorphic_safe_get(
|
||||
polymorphic_strict_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
@@ -237,13 +237,13 @@ polymorphic_safe_get(
|
||||
"call to boost::polymorphic_get<U>(const boost::variant<T...>*) will always return NULL"
|
||||
);
|
||||
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<U>::type
|
||||
polymorphic_safe_get(
|
||||
polymorphic_strict_get(
|
||||
boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
@@ -254,13 +254,13 @@ polymorphic_safe_get(
|
||||
"call to boost::polymorphic_get<U>(boost::variant<T...>&) will always throw boost::bad_polymorphic_get exception"
|
||||
);
|
||||
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
|
||||
inline
|
||||
typename add_reference<const U>::type
|
||||
polymorphic_safe_get(
|
||||
polymorphic_strict_get(
|
||||
const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& operand
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
@@ -271,7 +271,7 @@ polymorphic_safe_get(
|
||||
"call to boost::polymorphic_get<U>(const boost::variant<T...>&) will always throw boost::bad_polymorphic_get exception"
|
||||
);
|
||||
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -286,10 +286,10 @@ polymorphic_get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
#else
|
||||
return polymorphic_safe_get<U>(operand);
|
||||
return polymorphic_strict_get<U>(operand);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -302,10 +302,10 @@ polymorphic_get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
) BOOST_NOEXCEPT
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
#else
|
||||
return polymorphic_safe_get<U>(operand);
|
||||
return polymorphic_strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -317,10 +317,10 @@ polymorphic_get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
#else
|
||||
return polymorphic_safe_get<U>(operand);
|
||||
return polymorphic_strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -332,10 +332,10 @@ polymorphic_get(
|
||||
BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
|
||||
)
|
||||
{
|
||||
#ifdef BOOST_VARIANT_USE_UNSAFE_GET_BY_DEFAULT
|
||||
return polymorphic_unsafe_get<U>(operand);
|
||||
#ifdef BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
|
||||
return polymorphic_relaxed_get<U>(operand);
|
||||
#else
|
||||
return polymorphic_safe_get<U>(operand);
|
||||
return polymorphic_strict_get<U>(operand);
|
||||
#endif
|
||||
}
|
||||
} // namespace boost
|
||||
|
||||
+2
-2
@@ -58,11 +58,11 @@ T& check_pass(Variant& v, T value)
|
||||
template <typename T, typename Variant>
|
||||
void check_fail(Variant& v)
|
||||
{
|
||||
BOOST_CHECK(!unsafe_get<T>(&v));
|
||||
BOOST_CHECK(!relaxed_get<T>(&v));
|
||||
|
||||
try
|
||||
{
|
||||
T& r = unsafe_get<T>(v);
|
||||
T& r = relaxed_get<T>(v);
|
||||
(void)r; // suppress warning about r not being used
|
||||
BOOST_CHECK(false && &r); // should never reach
|
||||
}
|
||||
|
||||
+32
-32
@@ -41,17 +41,17 @@ inline void check_polymorphic_get_on_types_impl_single_type(V* v)
|
||||
if (!!boost::is_same<T, TestType>::value) {
|
||||
BOOST_CHECK(boost::polymorphic_get<TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_safe_get<TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_safe_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_unsafe_get<TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_unsafe_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_strict_get<TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_strict_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_relaxed_get<TestType>(v));
|
||||
BOOST_CHECK(boost::polymorphic_relaxed_get<const TestType>(v));
|
||||
} else {
|
||||
BOOST_CHECK(!boost::polymorphic_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_safe_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_safe_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_strict_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_strict_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<const TestType>(v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,17 +61,17 @@ inline void check_get_on_types_impl_single_type(V* v)
|
||||
if (!!boost::is_same<T, TestType>::value) {
|
||||
BOOST_CHECK(boost::get<TestType>(v));
|
||||
BOOST_CHECK(boost::get<const TestType>(v));
|
||||
BOOST_CHECK(boost::safe_get<TestType>(v));
|
||||
BOOST_CHECK(boost::safe_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::unsafe_get<TestType>(v));
|
||||
BOOST_CHECK(boost::unsafe_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::strict_get<TestType>(v));
|
||||
BOOST_CHECK(boost::strict_get<const TestType>(v));
|
||||
BOOST_CHECK(boost::relaxed_get<TestType>(v));
|
||||
BOOST_CHECK(boost::relaxed_get<const TestType>(v));
|
||||
} else {
|
||||
BOOST_CHECK(!boost::get<TestType>(v));
|
||||
BOOST_CHECK(!boost::get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::safe_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::safe_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::strict_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::strict_get<const TestType>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<TestType>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<const TestType>(v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,29 +93,29 @@ inline void check_get_on_types_impl(V* v)
|
||||
check_polymorphic_get_on_types_impl_single_type<T, V, std::string>(v);
|
||||
|
||||
// Never exist in here
|
||||
BOOST_CHECK(!boost::unsafe_get<short>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<const short>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<char>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<char*>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<bool>(v));
|
||||
BOOST_CHECK(!boost::unsafe_get<const bool>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<short>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<const short>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<char>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<char*>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<bool>(v));
|
||||
BOOST_CHECK(!boost::relaxed_get<const bool>(v));
|
||||
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<short>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<const short>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<char>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<char*>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<bool>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_unsafe_get<const bool>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<short>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<const short>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<char>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<char*>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<bool>(v));
|
||||
BOOST_CHECK(!boost::polymorphic_relaxed_get<const bool>(v));
|
||||
|
||||
boost::get<T>(*v); // Must compile
|
||||
boost::get<const T>(*v); // Must compile
|
||||
boost::safe_get<T>(*v); // Must compile
|
||||
boost::safe_get<const T>(*v); // Must compile
|
||||
boost::strict_get<T>(*v); // Must compile
|
||||
boost::strict_get<const T>(*v); // Must compile
|
||||
|
||||
boost::polymorphic_get<T>(*v); // Must compile
|
||||
boost::polymorphic_get<const T>(*v); // Must compile
|
||||
boost::polymorphic_safe_get<T>(*v); // Must compile
|
||||
boost::polymorphic_safe_get<const T>(*v); // Must compile
|
||||
boost::polymorphic_strict_get<T>(*v); // Must compile
|
||||
boost::polymorphic_strict_get<const T>(*v); // Must compile
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
|
||||
Reference in New Issue
Block a user