mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-15 05:16:39 +02:00
Fixes for Ticket #7569 ( Compile Error using BOOST_FUSION_DEFINE_STRUCT_INLINE with VC10 and GCC <4.5 )
[SVN r81165]
This commit is contained in:
@ -27,6 +27,17 @@ struct cls
|
||||
)
|
||||
};
|
||||
|
||||
template <typename = int>
|
||||
struct tpl_cls
|
||||
{
|
||||
BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(
|
||||
(X)(Y),
|
||||
point,
|
||||
(X, x)
|
||||
(Y, y)
|
||||
)
|
||||
};
|
||||
|
||||
namespace ns
|
||||
{
|
||||
BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), s, (M, m))
|
||||
@ -34,13 +45,11 @@ namespace ns
|
||||
BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, )
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
template <typename Point>
|
||||
void run_test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
typedef cls::point<int, int> point;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
@ -51,8 +60,8 @@ main()
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p(123, 456);
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<Point>));
|
||||
Point p(123, 456);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
@ -63,8 +72,8 @@ main()
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<Point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
@ -72,7 +81,7 @@ main()
|
||||
|
||||
{
|
||||
vector<int, float> v1(4, 2);
|
||||
point v2(5, 3);
|
||||
Point v2(5, 3);
|
||||
vector<long, double> v3(5, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
@ -85,15 +94,15 @@ main()
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
// conversion from Point to vector
|
||||
Point p(5, 3);
|
||||
vector<int, long> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
// conversion from Point to list
|
||||
Point p(5, 3);
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
@ -109,13 +118,20 @@ main()
|
||||
|
||||
|
||||
{
|
||||
point p = make_list(5,3);
|
||||
Point p = make_list(5,3);
|
||||
BOOST_TEST(p == make_vector(5,3));
|
||||
|
||||
p = make_list(3,5);
|
||||
BOOST_TEST(p == make_vector(3,5));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
run_test<cls::point<int, int> >(); // test non-template enclosing class
|
||||
run_test<tpl_cls<>::point<int, int> >(); // test template enclosing class
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user