mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 12:07:36 +02:00
Merge from Trunk
[SVN r49252]
This commit is contained in:
@ -89,6 +89,7 @@ import testing ;
|
||||
[ run sequence/tuple_misc.cpp : : : : ]
|
||||
[ run sequence/tuple_mutate.cpp : : : : ]
|
||||
[ run sequence/tuple_tie.cpp : : : : ]
|
||||
[ run sequence/tr1_tuple_auto_conv.cpp : : : : ]
|
||||
[ run sequence/transform_view.cpp : : : : ]
|
||||
[ run sequence/vector_comparison.cpp : : : : ]
|
||||
[ run sequence/vector_construction.cpp : : : : ]
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
Copyright (c) 2005-2006 Joao Abecasis
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
@ -127,10 +127,10 @@ class members
|
||||
{
|
||||
public:
|
||||
int data;
|
||||
|
||||
|
||||
members()
|
||||
: data(20)
|
||||
{ }
|
||||
{ }
|
||||
|
||||
int nullary() { return data + 1; }
|
||||
int nullary_c() const { return data + 2; }
|
||||
@ -340,17 +340,17 @@ void result_type_tests()
|
||||
using boost::is_same;
|
||||
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (*)(), fusion::vector0 >::type, int
|
||||
fusion::result_of::invoke<int (*)(), fusion::vector0 >::type, int
|
||||
>::value ));
|
||||
// disabled until boost::result_of supports it
|
||||
// BOOST_TEST(( is_same<
|
||||
// fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
|
||||
// fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
|
||||
// >::value ));
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
|
||||
>::value ));
|
||||
// disabled until boost::result_of supports it
|
||||
// BOOST_TEST(( is_same<
|
||||
// BOOST_TEST(( is_same<
|
||||
// fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
|
||||
// >::value ));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
Copyright (c) 2005-2006 Joao Abecasis
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
@ -41,7 +41,7 @@ struct object_nc : boost::noncopyable {};
|
||||
struct fobj
|
||||
{
|
||||
// Handle nullary separately to exercise result_of support
|
||||
template <typename Sig>
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, typename T0>
|
||||
@ -97,7 +97,7 @@ struct fobj_nc
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
|
||||
int operator()(int i) { return 14 + i; }
|
||||
int operator()(int i) const { return 15 + i; }
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
Copyright (c) 2005-2006 Joao Abecasis
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
@ -48,10 +48,10 @@ class members
|
||||
{
|
||||
public:
|
||||
int data;
|
||||
|
||||
|
||||
members()
|
||||
: data(20)
|
||||
{ }
|
||||
{ }
|
||||
|
||||
int nullary() { return element1 = data + 1; }
|
||||
int nullary_c() const { return element1 = data + 2; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -57,7 +57,9 @@ test()
|
||||
|
||||
FUSION_SEQUENCE<> empty0;
|
||||
|
||||
#ifndef TR1_TUPLE_TEST
|
||||
FUSION_SEQUENCE<> empty1(empty);
|
||||
#endif
|
||||
|
||||
FUSION_SEQUENCE<int> t1;
|
||||
BOOST_TEST(FUSION_AT<0>(t1) == int());
|
||||
|
56
test/sequence/tr1_tuple_auto_conv.cpp
Normal file
56
test/sequence/tr1_tuple_auto_conv.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include <boost/tr1/memory.hpp>
|
||||
#include <boost/tr1/tuple.hpp>
|
||||
#include <boost/any.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class AutoConverter
|
||||
{
|
||||
std::tr1::shared_ptr<boost::any> t_;
|
||||
|
||||
public:
|
||||
AutoConverter(std::tr1::shared_ptr<boost::any> const & t)
|
||||
: t_(t)
|
||||
{}
|
||||
|
||||
template <typename C>
|
||||
operator C ()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::any & a = (*t_);
|
||||
|
||||
return boost::any_cast<C>(a);
|
||||
}
|
||||
catch(boost::bad_any_cast & e)
|
||||
{
|
||||
std::cerr << "Internal conversion bug: "
|
||||
<< "Failed to convert data holder to "
|
||||
<< typeid(C).name() << "\n"
|
||||
<< e.what()
|
||||
<< std::endl;
|
||||
|
||||
C c = C();
|
||||
return c;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline AutoConverter Demo()
|
||||
{
|
||||
std::tr1::shared_ptr<boost::any> p_result
|
||||
(new boost::any(std::tr1::make_tuple(1, 2, 3, 4)));
|
||||
return p_result;
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::tr1::tuple<int, int, int, int> test = Core::Demo();
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,12 +2,13 @@
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/tuple/tuple.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
|
||||
#define TR1_TUPLE_TEST
|
||||
#define FUSION_SEQUENCE tuple
|
||||
#define FUSION_AT get
|
||||
#include "construction.hpp"
|
||||
|
Reference in New Issue
Block a user