mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-24 01:27:37 +02:00
merged fusion from the trunk
[SVN r63560]
This commit is contained in:
@ -31,7 +31,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int x, int y) : x(x), y(y) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
@ -98,14 +98,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
boost::fusion::vector<int, short> v(p);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
boost::fusion::list<int, short> l(p);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int x, int y) : x(x), y(y) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
@ -63,7 +63,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep(123, 456);
|
||||
adapted::point p(basep);
|
||||
|
||||
@ -102,7 +102,7 @@ main()
|
||||
// conversion from adapted::point to vector
|
||||
ns::point basep(5, 3);
|
||||
adapted::point p(basep);
|
||||
boost::fusion::vector<int, short> v(p);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ main()
|
||||
// conversion from adated::point to list
|
||||
ns::point basep(5, 3);
|
||||
adapted::point p(basep);
|
||||
boost::fusion::list<int, short> l(p);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p = {5, 3};
|
||||
fusion::vector<int, short> v(p);
|
||||
fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p = {5, 3};
|
||||
fusion::list<int, short> l(p);
|
||||
fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep = {123, 456};
|
||||
adapted::point p(basep);
|
||||
|
||||
@ -88,7 +88,7 @@ main()
|
||||
// conversion from adapted::point to vector
|
||||
ns::point basep = {5, 3};
|
||||
adapted::point p(basep);
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ main()
|
||||
// conversion from adapted::point to list
|
||||
ns::point basep = {5, 3};
|
||||
adapted::point p(basep);
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(X x, Y y) : x(x), y(y) {}
|
||||
point(X in_x, Y in_y) : x(in_x), y(in_y) {}
|
||||
|
||||
X get_x() const { return x; }
|
||||
Y get_y() const { return y; }
|
||||
@ -102,14 +102,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
boost::fusion::vector<int, short> v(p);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
boost::fusion::list<int, short> l(p);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -102,14 +102,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p = {5, 3};
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p = {5, 3};
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int x, int y) : x(x), y(y) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
@ -106,14 +106,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
fusion::vector<int, short> v(p);
|
||||
fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
fusion::list<int, short> l(p);
|
||||
fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int x, int y) : x(x), y(y) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
@ -71,7 +71,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep(123, 456);
|
||||
adapted::point p(basep);
|
||||
|
||||
@ -112,7 +112,7 @@ main()
|
||||
ns::point basep(5, 3);
|
||||
adapted::point p(basep);
|
||||
|
||||
fusion::vector<int, short> v(p);
|
||||
fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ main()
|
||||
ns::point basep(5, 3);
|
||||
adapted::point p(basep);
|
||||
|
||||
fusion::list<int, short> l(p);
|
||||
fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p = {5, 3};
|
||||
fusion::vector<int, short> v(p);
|
||||
fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p = {5, 3};
|
||||
fusion::list<int, short> l(p);
|
||||
fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep = {123, 456};
|
||||
adapted::point p(basep);
|
||||
|
||||
@ -103,7 +103,7 @@ main()
|
||||
// conversion from adapted::point to vector
|
||||
ns::point basep = {5, 3};
|
||||
adapted::point p(basep);
|
||||
fusion::vector<int, short> v(p);
|
||||
fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ main()
|
||||
// conversion from adapted::point to list
|
||||
ns::point basep = {5, 3};
|
||||
adapted::point p(basep);
|
||||
fusion::list<int, short> l(p);
|
||||
fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace ns
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(X x, Y y) : x(x), y(y) {}
|
||||
point(X x_, Y y_) : x(x_), y(y_) {}
|
||||
|
||||
X get_x() const { return x; }
|
||||
Y get_y() const { return y; }
|
||||
@ -110,14 +110,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
boost::fusion::vector<int, short> v(p);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
boost::fusion::list<int, short> l(p);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p = {5, 3};
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p = {5, 3};
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using boost::is_same;
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -39,18 +40,18 @@ main()
|
||||
make_cons(1, make_cons(hello));
|
||||
|
||||
BOOST_TEST((*begin(ns) == 1));
|
||||
BOOST_TEST((*next(begin(ns)) == hello));
|
||||
BOOST_TEST((*fusion::next(begin(ns)) == hello));
|
||||
|
||||
*begin(ns) += 1;
|
||||
*next(begin(ns)) += ' ';
|
||||
*fusion::next(begin(ns)) += ' ';
|
||||
|
||||
BOOST_TEST((*begin(ns) == 2));
|
||||
BOOST_TEST((*next(begin(ns)) == hello + ' '));
|
||||
BOOST_TEST((*fusion::next(begin(ns)) == hello + ' '));
|
||||
|
||||
for_each(ns, boost::lambda::_1 += ' ');
|
||||
|
||||
BOOST_TEST((*begin(ns) == 2 + ' '));
|
||||
BOOST_TEST((*next(begin(ns)) == hello + ' ' + ' '));
|
||||
BOOST_TEST((*fusion::next(begin(ns)) == hello + ' ' + ' '));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -75,14 +75,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -79,14 +79,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,14 @@ main()
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,14 @@ main()
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
vector<int, short> v(p);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
list<int, short> l(p);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,9 @@ main()
|
||||
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
|
||||
}
|
||||
|
||||
{
|
||||
//cschmidt: This is illegal C++. ADL instantiates less<_, int_<3> > - which
|
||||
//leads to compile errors.
|
||||
/*{
|
||||
// $$$ JDG $$$ For some obscure reason, EDG based compilers
|
||||
// (e.g. comeau 4.3.3, intel) have problems with this.
|
||||
// vc7.1 and g++ are ok. The errors from comeau are useless.
|
||||
@ -94,7 +96,7 @@ main()
|
||||
BOOST_TEST((view == make_vector(1, 2, 0, -1)));
|
||||
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
|
||||
#endif
|
||||
}
|
||||
}*/
|
||||
|
||||
{
|
||||
// Previous filtering out all values caused problems as begin<seq> was not equal to end<seq>
|
||||
|
@ -28,6 +28,7 @@ int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -104,9 +105,9 @@ main()
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<range_type>::type>::type>::type, char>));
|
||||
|
||||
std::cout << deref_data(begin(r)) << std::endl;
|
||||
std::cout << deref_data(next(begin(r))) << std::endl;
|
||||
std::cout << deref_data(fusion::next(begin(r))) << std::endl;
|
||||
BOOST_TEST((deref_data(begin(r)) == "foo"));
|
||||
BOOST_TEST((deref_data(next(begin(r))) == 'x'));
|
||||
BOOST_TEST((deref_data(fusion::next(begin(r))) == 'x'));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -34,6 +34,7 @@ int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -175,11 +176,11 @@ main()
|
||||
, float>));
|
||||
|
||||
std::cout << deref_data(begin(j)) << std::endl;
|
||||
std::cout << deref_data(boost::fusion::next(begin(j))) << std::endl;
|
||||
std::cout << deref_data(next(boost::fusion::next(begin(j)))) << std::endl;
|
||||
std::cout << deref_data(fusion::next(begin(j))) << std::endl;
|
||||
std::cout << deref_data(fusion::next(fusion::next(begin(j)))) << std::endl;
|
||||
BOOST_TEST((deref_data(begin(j)) == 0));
|
||||
BOOST_TEST((deref_data(boost::fusion::next(begin(j))) == "foo"));
|
||||
BOOST_TEST((deref_data(next(boost::fusion::next(begin(j)))) == 1.3f));
|
||||
BOOST_TEST((deref_data(fusion::next(begin(j))) == "foo"));
|
||||
BOOST_TEST((deref_data(fusion::next(fusion::next(begin(j)))) == 1.3f));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -29,6 +29,7 @@ main()
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
namespace fusion = boost::fusion;
|
||||
using boost::fusion::pair;
|
||||
using boost::fusion::make_pair;
|
||||
|
||||
@ -66,15 +67,15 @@ main()
|
||||
BOOST_STATIC_ASSERT((!result_of::has_key<map_type, std::string>::value));
|
||||
|
||||
std::cout << deref_data(begin(m)) << std::endl;
|
||||
std::cout << deref_data(next(begin(m))) << std::endl;
|
||||
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
|
||||
|
||||
BOOST_TEST(deref_data(begin(m)) == 'X');
|
||||
BOOST_TEST(deref_data(next(begin(m))) == "Men");
|
||||
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Men");
|
||||
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::key_of<result_of::begin<map_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::key_of<result_of::next<result_of::begin<map_type>::type>::type>::type, double>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::value_of_data<result_of::begin<map_type>::type>::type, char>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::value_of_data<result_of::next<result_of::begin<map_type>::type>::type>::type, std::string>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<map_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<map_type>::type>::type>::type, double>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<map_type>::type>::type, char>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<map_type>::type>::type>::type, std::string>::value));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ test()
|
||||
{ // testing front & back
|
||||
|
||||
typedef FUSION_SEQUENCE<int, float, std::string> tup;
|
||||
tup t(1, 2.2, "Kimpo");
|
||||
tup t(1, 2.2f, "Kimpo");
|
||||
|
||||
BOOST_TEST(front(t) == 1);
|
||||
#if !defined(FUSION_FORWARD_ONLY) // list has no back
|
||||
|
@ -26,7 +26,7 @@ BOOST_FUSION_ADAPT_STRUCT(
|
||||
(int, int_)
|
||||
(std::string, string_)
|
||||
(double, double_)
|
||||
);
|
||||
)
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
|
@ -29,6 +29,7 @@ main()
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
namespace fusion = boost::fusion;
|
||||
using boost::fusion::pair;
|
||||
using boost::fusion::make_pair;
|
||||
|
||||
@ -61,15 +62,15 @@ main()
|
||||
BOOST_STATIC_ASSERT((!result_of::has_key<set_type, double>::value));
|
||||
|
||||
std::cout << deref_data(begin(m)) << std::endl;
|
||||
std::cout << deref_data(next(begin(m))) << std::endl;
|
||||
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
|
||||
|
||||
BOOST_TEST(deref_data(begin(m)) == 123);
|
||||
BOOST_TEST(deref_data(next(begin(m))) == "Hola");
|
||||
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Hola");
|
||||
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::key_of<result_of::begin<set_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::key_of<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::value_of_data<result_of::begin<set_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((is_same<result_of::value_of_data<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<set_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<set_type>::type>::type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace Core
|
||||
} // namespace Core
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main()
|
||||
{
|
||||
std::tr1::tuple<int, int, int, int> test = Core::Demo();
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user