Exemplo n.º 1
0
void test_cv(T C::*)
{
  BOOST_MPL_ASSERT(( 
    ft::is_function<T, ft::const_qualified > 
  ));

  BOOST_MPL_ASSERT(( 
    ft::is_function<T, ft::volatile_qualified > 
  ));

  BOOST_MPL_ASSERT(( 
    ft::is_function<T, ft::tag<ft::const_qualified,ft::volatile_qualified> > 
  ));

  BOOST_MPL_ASSERT_NOT(( 
    ft::is_function<T, ft::non_const > 
  ));

  BOOST_MPL_ASSERT_NOT(( 
    ft::is_function<T, ft::non_volatile > 
  ));

  BOOST_MPL_ASSERT_NOT(( 
    ft::is_function<T, ft::tag<ft::non_const,ft::non_volatile> > 
  ));
}
Exemplo n.º 2
0
std::auto_ptr< boost::ptr_list<Clonable> >
new_list0()
{
    BOOST_MPL_ASSERT_NOT((boost::is_const<Clonable>));
    boost::ptr_list<Clonable> pc;
    return pc.clone();
}
Exemplo n.º 3
0
std::auto_ptr< boost::ptr_list<Clonable> >
new_list(Range const& rng)
{
    BOOST_MPL_ASSERT_NOT((boost::is_const<Clonable>));
    boost::ptr_list<Clonable> pc;
    std::for_each(boost::begin(rng), boost::end(rng), test::push_back_new<Clonable>(pc));
    return pc.clone();
}
Exemplo n.º 4
0
int main()
  {
  
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntType)<AType>::type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntTypeReference)<AType>::type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AType>::type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<TheInteger<AType::BType>::type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>::type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<SomethingElse<AnotherType>::type>));
  
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<NameStruct<AType,MarkerType>::type,NameStruct<AType,MarkerType>::boost_tti_marker_type>));
  BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::boost_tti_marker_type>));
  
  BOOST_MPL_ASSERT_NOT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AnotherType>::type>));
  BOOST_MPL_ASSERT_NOT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::boost_tti_marker_type>));
  
  return 0;

  }
Exemplo n.º 5
0
    inline void operator()(Base*) const
    {
        BOOST_MPL_ASSERT_NOT((is_same<Base,Derived>));
        
        // Register the Base class
        register_dynamic_id<Base>();

        // Register the up-cast
        register_conversion<Derived,Base>(false);

        // Register the down-cast, if appropriate.
        this->register_downcast((Base*)0, is_polymorphic<Base>());
    }
Exemplo n.º 6
0
    inline void operator()(Base*) const
    {
# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200)
        BOOST_MPL_ASSERT_NOT((is_same<Base,Derived>));
# else
        BOOST_STATIC_ASSERT(!(is_same<Base,Derived>::value));
# endif 
        
        // Register the Base class
        register_dynamic_id<Base>();

        // Register the up-cast
        register_conversion<Derived,Base>(false);

        // Register the down-cast, if appropriate.
        this->register_downcast((Base*)0, is_polymorphic<Base>());
    }
Exemplo n.º 7
0
 void check_not (Predicate<Expr> const & ) {
   BOOST_MPL_ASSERT_NOT((proto::matches<Expr, Predicate_Grammar>));
 }
Exemplo n.º 8
0
void container_test(X& r, T const&)
{
    typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
    typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
    typedef BOOST_DEDUCED_TYPENAME X::difference_type difference_type;
    typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;

    typedef BOOST_DEDUCED_TYPENAME boost::iterator_value<iterator>::type iterator_value_type;
    typedef BOOST_DEDUCED_TYPENAME boost::iterator_value<const_iterator>::type const_iterator_value_type;
    typedef BOOST_DEDUCED_TYPENAME boost::iterator_difference<iterator>::type iterator_difference_type;
    typedef BOOST_DEDUCED_TYPENAME boost::iterator_difference<const_iterator>::type const_iterator_difference_type;

    typedef BOOST_DEDUCED_TYPENAME X::value_type value_type;
    typedef BOOST_DEDUCED_TYPENAME X::reference reference;
    typedef BOOST_DEDUCED_TYPENAME X::const_reference const_reference;

    // value_type

    BOOST_MPL_ASSERT((boost::is_same<T, value_type>));
    boost::function_requires<boost::CopyConstructibleConcept<X> >();

    // reference_type / const_reference_type

    BOOST_MPL_ASSERT((boost::is_same<T&, reference>));
    BOOST_MPL_ASSERT((boost::is_same<T const&, const_reference>));

    // iterator

    boost::function_requires<boost::InputIteratorConcept<iterator> >();
    BOOST_MPL_ASSERT((boost::is_same<T, iterator_value_type>));
    BOOST_MPL_ASSERT((boost::is_convertible<iterator, const_iterator>));

    // const_iterator

    boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
    BOOST_MPL_ASSERT((boost::is_same<T, const_iterator_value_type>));

    // difference_type

    BOOST_MPL_ASSERT((boost::mpl::bool_<
                std::numeric_limits<difference_type>::is_signed>));
    BOOST_MPL_ASSERT((boost::mpl::bool_<
                std::numeric_limits<difference_type>::is_integer>));
    BOOST_MPL_ASSERT((boost::is_same<difference_type,
                iterator_difference_type>));
    BOOST_MPL_ASSERT((boost::is_same<difference_type,
                const_iterator_difference_type>));

    // size_type

    BOOST_MPL_ASSERT_NOT((boost::mpl::bool_<
                std::numeric_limits<size_type>::is_signed>));
    BOOST_MPL_ASSERT((boost::mpl::bool_<
                std::numeric_limits<size_type>::is_integer>));

    // size_type can represent any non-negative value type of difference_type
    // I'm not sure about either of these tests...
    size_type max_diff((std::numeric_limits<difference_type>::max)());
    difference_type converted_diff(max_diff);
    BOOST_TEST((std::numeric_limits<difference_type>::max)()
            == converted_diff);

    BOOST_TEST(
        static_cast<comparison_type>(
            (std::numeric_limits<size_type>::max)()) >
        static_cast<comparison_type>(
            (std::numeric_limits<difference_type>::max)()));

    // I don't test the runtime post-conditions here.
    X u;
    BOOST_TEST(u.size() == 0);
    BOOST_TEST(X().size() == 0);

    X a,b;

    sink(X(a));
    X u2(a);
    X u3 = a;

    X* ptr = new X();
    X& a1 = *ptr;
    (&a1)->~X();

    X const a_const;
    test::check_return_type<iterator>::equals(a.begin());
    test::check_return_type<const_iterator>::equals(a_const.begin());
    test::check_return_type<const_iterator>::equals(a.cbegin());
    test::check_return_type<const_iterator>::equals(a_const.cbegin());
    test::check_return_type<iterator>::equals(a.end());
    test::check_return_type<const_iterator>::equals(a_const.end());
    test::check_return_type<const_iterator>::equals(a.cend());
    test::check_return_type<const_iterator>::equals(a_const.cend());

    a.swap(b);
    test::check_return_type<X>::equals_ref(r = a);
    test::check_return_type<size_type>::equals(a.size());
    test::check_return_type<size_type>::equals(a.max_size());
    test::check_return_type<bool>::convertible(a.empty());

    // Allocator

    typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
    test::check_return_type<allocator_type>::equals(a_const.get_allocator());
}
int main(int,char *[])
{
    BOOST_MPL_ASSERT((bu::is_dimension_list<bu::dimensionless_type>));
    BOOST_MPL_ASSERT((bu::is_dimension_list<dimension>));
    BOOST_MPL_ASSERT_NOT((bu::is_dimension_list<boost::mpl::list0<> >));
    BOOST_MPL_ASSERT_NOT((bu::is_dimension_list<int>));

    BOOST_MPL_ASSERT((bu::is_unit<bu::unit<bu::dimensionless_type, system1> >));
    BOOST_MPL_ASSERT((bu::is_unit<bu::unit<dimension, system1> >));
    BOOST_MPL_ASSERT_NOT((bu::is_unit<int>));

    BOOST_MPL_ASSERT((bu::is_unit_of_system<bu::unit<bu::dimensionless_type, system1>, system1>));
    BOOST_MPL_ASSERT((bu::is_unit_of_system<bu::unit<dimension, system1>, system1>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system<bu::unit<bu::dimensionless_type, system1>, system2>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system<bu::unit<dimension, system1>, system2>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system<int, system1>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system<int, system2>));

    BOOST_MPL_ASSERT((bu::is_unit_of_dimension<bu::unit<bu::dimensionless_type, system1>, bu::dimensionless_type>));
    BOOST_MPL_ASSERT((bu::is_unit_of_dimension<bu::unit<dimension, system1>, dimension>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension<bu::unit<bu::dimensionless_type, system1>, dimension>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension<bu::unit<dimension, system1>, bu::dimensionless_type>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension<int, bu::dimensionless_type>));
    BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension<int, dimension>));

    BOOST_MPL_ASSERT((bu::is_quantity<bu::quantity<bu::unit<bu::dimensionless_type, system1> > >));
    BOOST_MPL_ASSERT((bu::is_quantity<bu::quantity<bu::unit<dimension, system1> > >));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity<int>));

    BOOST_MPL_ASSERT((bu::is_quantity<bu::quantity<bu::unit<bu::dimensionless_type, system1>, int> >));
    BOOST_MPL_ASSERT((bu::is_quantity<bu::quantity<bu::unit<dimension, system1>, int> >));

    BOOST_MPL_ASSERT((bu::is_quantity_of_system<bu::quantity<bu::unit<bu::dimensionless_type, system1> >, system1>));
    BOOST_MPL_ASSERT((bu::is_quantity_of_system<bu::quantity<bu::unit<dimension, system1> >, system1>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system<bu::quantity<bu::unit<bu::dimensionless_type, system1> >, system2>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system<bu::quantity<bu::unit<dimension, system1> >, system2>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system<int, system1>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system<int, system2>));

    BOOST_MPL_ASSERT((bu::is_quantity_of_dimension<bu::quantity<bu::unit<bu::dimensionless_type, system1> >, bu::dimensionless_type>));
    BOOST_MPL_ASSERT((bu::is_quantity_of_dimension<bu::quantity<bu::unit<dimension, system1> >, dimension>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension<bu::quantity<bu::unit<bu::dimensionless_type, system1> >, dimension>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension<bu::quantity<bu::unit<dimension, system1> >, bu::dimensionless_type>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension<int, bu::dimensionless_type>));
    BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension<int, dimension>));

    return 0;
}
Exemplo n.º 10
0
 void check_not (Int<Expr> const & ) {
   BOOST_MPL_ASSERT_NOT((proto::matches<Expr, Int_Grammar>));
 }
Exemplo n.º 11
0
 void check_not (QF_BV<Expr> const & ) {
   BOOST_MPL_ASSERT_NOT((proto::matches<Expr, QF_BV_Grammar>));
 }
Exemplo n.º 12
0
 void check_not (Array<Expr> const & ) {
   BOOST_MPL_ASSERT_NOT((proto::matches<Expr, Array_Grammar>));
 }
Exemplo n.º 13
0
void foo(F&)
{
    BOOST_MPL_ASSERT_NOT((boost::is_pointer<F>));
    BOOST_MPL_ASSERT((boost::is_function<F>));
}