workaround for VC7.1 getting confused with optional and variant boost::get functions

[SVN r37337]
This commit is contained in:
Joel de Guzman
2007-04-02 13:20:16 +00:00
parent 0913d82b43
commit 6a01312869

View File

@ -19,6 +19,7 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/variant/get.hpp>
#include <boost/detail/workaround.hpp>
namespace boost { namespace fusion
{
@ -85,6 +86,20 @@ namespace boost { namespace fusion
add_reference<value_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
call(Iterator const & it)
{
@ -94,6 +109,7 @@ namespace boost { namespace fusion
it.var_ = type(); // prime the variant
return *boost::get<type>(&it.var_); // no-throw!
}
#endif
};
};
}}