2003-05-26 06:46:17 +00:00
|
|
|
|
2004-09-02 15:41:37 +00:00
|
|
|
// Copyright Aleksey Gurtovoy 2001-2004
|
2002-11-16 10:02:11 +00:00
|
|
|
//
|
2004-09-02 15:41:37 +00:00
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
2004-07-26 00:32:12 +00:00
|
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
2003-05-26 06:46:17 +00:00
|
|
|
//
|
|
|
|
|
// See http://www.boost.org/libs/mpl for documentation.
|
2002-11-16 10:02:11 +00:00
|
|
|
|
2008-10-10 09:21:07 +00:00
|
|
|
// $Id$
|
2004-09-02 15:41:37 +00:00
|
|
|
// $Date$
|
|
|
|
|
// $Revision$
|
|
|
|
|
|
|
|
|
|
#include <boost/mpl/joint_view.hpp>
|
2002-11-16 10:02:11 +00:00
|
|
|
|
2004-09-02 15:41:37 +00:00
|
|
|
#include <boost/mpl/range_c.hpp>
|
2004-10-01 16:32:41 +00:00
|
|
|
#include <boost/mpl/list.hpp>
|
2004-09-02 15:41:37 +00:00
|
|
|
#include <boost/mpl/equal.hpp>
|
|
|
|
|
#include <boost/mpl/size.hpp>
|
2014-09-19 18:55:00 -06:00
|
|
|
#include <boost/mpl/aux_/test.hpp>
|
2002-11-16 10:02:11 +00:00
|
|
|
|
2004-10-01 16:32:41 +00:00
|
|
|
|
2004-09-02 15:41:37 +00:00
|
|
|
MPL_TEST_CASE()
|
2002-11-16 10:02:11 +00:00
|
|
|
{
|
2004-09-02 15:41:37 +00:00
|
|
|
typedef joint_view<
|
|
|
|
|
range_c<int,0,10>
|
|
|
|
|
, range_c<int,10,15>
|
2002-11-16 10:02:11 +00:00
|
|
|
> numbers;
|
|
|
|
|
|
2004-09-02 15:41:37 +00:00
|
|
|
typedef range_c<int,0,15> answer;
|
2002-11-16 10:02:11 +00:00
|
|
|
|
2004-09-02 15:41:37 +00:00
|
|
|
MPL_ASSERT(( equal<numbers,answer> ));
|
2015-03-21 22:19:56 -03:00
|
|
|
MPL_ASSERT(( equal<numbers::type,answer> ));
|
2004-09-02 15:41:37 +00:00
|
|
|
MPL_ASSERT_RELATION( size<numbers>::value, ==, 15 );
|
2002-11-16 10:02:11 +00:00
|
|
|
}
|
2004-10-01 16:32:41 +00:00
|
|
|
|
|
|
|
|
template< typename View > struct test_is_empty
|
|
|
|
|
{
|
|
|
|
|
typedef typename begin<View>::type first_;
|
|
|
|
|
typedef typename end<View>::type last_;
|
2014-09-19 18:55:00 -06:00
|
|
|
|
2004-10-01 16:32:41 +00:00
|
|
|
MPL_ASSERT_RELATION( size<View>::value, ==, 0 );
|
|
|
|
|
MPL_ASSERT(( is_same< first_,last_> ));
|
2014-09-19 18:55:00 -06:00
|
|
|
|
2004-10-01 16:32:41 +00:00
|
|
|
MPL_ASSERT_INSTANTIATION( View );
|
|
|
|
|
MPL_ASSERT_INSTANTIATION( first_ );
|
|
|
|
|
MPL_ASSERT_INSTANTIATION( last_ );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MPL_TEST_CASE()
|
|
|
|
|
{
|
|
|
|
|
test_is_empty< joint_view< list0<>,list0<> > >();
|
|
|
|
|
test_is_empty< joint_view< list<>,list0<> > >();
|
|
|
|
|
test_is_empty< joint_view< list<>,list<> > >();
|
|
|
|
|
test_is_empty< joint_view< list<>, joint_view< list0<>,list0<> > > >();
|
|
|
|
|
}
|