mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-16 05:42:20 +02:00
result_of and polymorphic function obj compatibility
[SVN r37962]
This commit is contained in:
@ -15,6 +15,9 @@
|
||||
#include <boost/fusion/sequence/generation/make_vector.hpp>
|
||||
#include <boost/fusion/sequence/container/vector.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
using boost::noncopyable;
|
||||
|
||||
@ -52,17 +55,33 @@ struct test_func
|
||||
int main()
|
||||
{
|
||||
test_func<noncopyable> f;
|
||||
fusion::fused< test_func<> > fused_func;
|
||||
fusion::fused< test_func<noncopyable> & > fused_func_ref(f);
|
||||
fusion::fused< test_func<> const > fused_func_c;
|
||||
fusion::fused< test_func<> > const fused_func_c2;
|
||||
fusion::fused< test_func<noncopyable> const & > fused_func_c_ref(f);
|
||||
|
||||
fusion::vector<int,char> lv_vec(1,'\004');
|
||||
typedef fusion::fused< test_func<> > ff;
|
||||
ff fused_func;
|
||||
|
||||
typedef fusion::fused< test_func<noncopyable> & > ffr;
|
||||
ffr fused_func_ref(f);
|
||||
|
||||
typedef fusion::fused< test_func<> const > ffc;
|
||||
ffc fused_func_c;
|
||||
|
||||
typedef fusion::fused< test_func<> > const ffc2;
|
||||
ffc2 fused_func_c2;
|
||||
|
||||
typedef fusion::fused< test_func<noncopyable> const & > ffcr;
|
||||
ffcr fused_func_c_ref(f);
|
||||
|
||||
typedef fusion::vector<int,char> vec;
|
||||
vec lv_vec(1,'\004');
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ff(vec)>::type, int>));
|
||||
BOOST_TEST(fused_func(lv_vec) == 1);
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffr(vec)>::type, int>));
|
||||
BOOST_TEST(fused_func_c(lv_vec) == 0);
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffc(vec)>::type, int>));
|
||||
BOOST_TEST(fused_func_c2(lv_vec) == 0);
|
||||
BOOST_TEST(fused_func_ref(lv_vec) == 1);
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffcr(vec)>::type, int>));
|
||||
BOOST_TEST(fused_func_c_ref(lv_vec) == 0);
|
||||
|
||||
BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1);
|
||||
|
Reference in New Issue
Block a user