forked from boostorg/fusion
workaround for VC7.1 getting confused with optional and variant boost::get functions
[SVN r37337]
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
#include <boost/type_traits/add_const.hpp>
|
#include <boost/type_traits/add_const.hpp>
|
||||||
#include <boost/type_traits/add_reference.hpp>
|
#include <boost/type_traits/add_reference.hpp>
|
||||||
#include <boost/variant/get.hpp>
|
#include <boost/variant/get.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace boost { namespace fusion
|
namespace boost { namespace fusion
|
||||||
{
|
{
|
||||||
@ -85,6 +86,20 @@ namespace boost { namespace fusion
|
|||||||
add_reference<value_type>::type
|
add_reference<value_type>::type
|
||||||
type;
|
type;
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
|
||||||
|
// for some unknown reason (compiler bug) VC7.1 gets confused with
|
||||||
|
// variant and optional get functions.
|
||||||
|
static type
|
||||||
|
call(Iterator const & it)
|
||||||
|
{
|
||||||
|
boost::detail::variant::get_visitor<type> v;
|
||||||
|
typedef typename mpl::deref<typename Iterator::iterator>::type type;
|
||||||
|
if (type* result = it.var_.apply_visitor(v))
|
||||||
|
return *result;
|
||||||
|
it.var_ = type(); // prime the variant
|
||||||
|
return *it.var_.apply_visitor(v); // no-throw!
|
||||||
|
}
|
||||||
|
#else
|
||||||
static type
|
static type
|
||||||
call(Iterator const & it)
|
call(Iterator const & it)
|
||||||
{
|
{
|
||||||
@ -94,6 +109,7 @@ namespace boost { namespace fusion
|
|||||||
it.var_ = type(); // prime the variant
|
it.var_ = type(); // prime the variant
|
||||||
return *boost::get<type>(&it.var_); // no-throw!
|
return *boost::get<type>(&it.var_); // no-throw!
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
|
Reference in New Issue
Block a user