コード例 #1
0
 static inline void
 apply(Geometry1& geometry1, const Geometry2& geometry2)
 {
     concept::check<Geometry1>();
     concept::check<Geometry2 const>();
     concept::check_concepts_and_equal_dimensions<Geometry1, Geometry2 const>();
         
     static bool const same_point_order
         = point_order<Geometry1>::value == point_order<Geometry2>::value;
     BOOST_MPL_ASSERT_MSG
     (
         (same_point_order),
         ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_POINT_ORDER,
         (types<Geometry1, Geometry2>)
     );
     static bool const same_closure
         = closure<Geometry1>::value == closure<Geometry2>::value;
     BOOST_MPL_ASSERT_MSG
     (
         (same_closure),
         ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_CLOSURE,
         (types<Geometry1, Geometry2>)
     );
         
     dispatch::convert<Geometry2, Geometry1>::apply(geometry2, geometry1);
 }
コード例 #2
0
ファイル: assign.hpp プロジェクト: AKinanS/Server
inline void assign(Geometry1& geometry1, Geometry2 const& geometry2)
{
    concept::check_concepts_and_equal_dimensions<Geometry1, Geometry2 const>();

    bool const same_point_order = 
            point_order<Geometry1>::value == point_order<Geometry2>::value;
    bool const same_closure = 
            closure<Geometry1>::value == closure<Geometry2>::value;

    BOOST_MPL_ASSERT_MSG
        (
            same_point_order, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_POINT_ORDER
            , (types<Geometry1, Geometry2>)
        );
    BOOST_MPL_ASSERT_MSG
        (
            same_closure, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_CLOSURE
            , (types<Geometry1, Geometry2>)
        );

    dispatch::convert
        <
            false,
            typename tag<Geometry2>::type,
            typename tag<Geometry1>::type,
            dimension<Geometry1>::type::value,
            Geometry2,
            Geometry1
        >::apply(geometry2, geometry1);
}
コード例 #3
0
    inline bool
    generate_delimited(detail::output_iterator<OutputIterator>& sink, 
        Expr const& xpr, Parameter const& param, Delimiter const& delimiter)
    {
        typedef
            spirit::traits::is_component<karma::domain, Expr>
        expr_is_component;
        typedef
            spirit::traits::is_component<karma::domain, Delimiter>
        delimiter_is_component;

        // report invalid expression errors as early as possible
        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
            xpr_is_not_convertible_to_a_generator, 
            (OutputIterator, Expr, Parameter, Delimiter));

        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
            delimiter_is_not_convertible_to_a_generator, 
            (OutputIterator, Expr, Parameter, Delimiter));
        
        typedef
            typename result_of::as_component<karma::domain, Expr>::type
        component;
        typedef typename component::director director;
        typedef
            typename result_of::as_component<karma::domain, Delimiter>::type
        delim_component;

        component c = spirit::as_component(karma::domain(), xpr);
        delim_component d = spirit::as_component(karma::domain(), delimiter);
        return director::generate(c, sink, unused, d, param);
    }
コード例 #4
0
    inline static bool 
    center_generate(OutputIterator& sink, Context& ctx, 
        Delimiter const& d, Parameter const& param, Embedded const& e, 
        unsigned int const width, Padding const& p) 
    {
        // make sure all generator parameters are valid
        BOOST_MPL_ASSERT_MSG(
            (spirit::traits::is_component<karma::domain, Embedded>::value), 
            embedded_is_not_convertible_to_a_generator, (Context, Embedded));

        BOOST_MPL_ASSERT_MSG(
            (spirit::traits::is_component<karma::domain, Padding>::value), 
            padding_is_not_convertible_to_a_generator, (Context, Padding));

        typedef 
            typename result_of::as_component<karma::domain, Embedded>::type 
        embedded;
        typedef 
            typename result_of::as_component<karma::domain, Padding>::type 
        padding;

        // wrap the given output iterator to allow left padding
        detail::enable_buffering<OutputIterator> buffering(sink, width);

        // first generate the embedded output 
        embedded ec = spirit::as_component(karma::domain(), e);
        typedef typename embedded::director director;
        bool r = director::generate(ec, sink, ctx, d, param);

        buffering.disable();    // do not perform buffering any more
        
        // generate the left padding
        detail::enable_counting<OutputIterator> 
            counting(sink, (sink.buffer_size() + width) / 2);

        padding pc = spirit::as_component(karma::domain(), p);
        typedef typename padding::director padding_director;
        while (r && sink.count() < width) 
            r = padding_director::generate(pc, sink, ctx, unused, unused);

        if (r) {
            // copy the embedded output to the target output iterator
            sink.buffer_copy();
        
            // generate the right padding
            std::size_t const max_count = width + (width - sink.buffer_size()) / 2;
            while (r && sink.count() < max_count) 
                r = padding_director::generate(pc, sink, ctx, unused, unused);
        }
        return r;
    }
コード例 #5
0
ファイル: algorithm.hpp プロジェクト: sschaetz/nt2
  U* transform(T const* begin, T const* end, U* out, UnOp f)
  {
    typedef boost::simd::native<T, BOOST_SIMD_DEFAULT_EXTENSION> vT;
    typedef boost::simd::native<U, BOOST_SIMD_DEFAULT_EXTENSION> vU;

    BOOST_MPL_ASSERT_MSG( vT::static_size == vU::static_size
                        , BOOST_SIMD_TRANSFORM_INPUT_OUTPUT_NOT_SAME_SIZE
                        , (T, U)
                        );

    static const std::size_t N = vU::static_size;

    std::size_t shift = simd::align_on(out, N * sizeof(U)) - out;
    T const* end2 = begin + shift;
    T const* end3 = end2 + (end - end2)/N*N;

    // prologue
    for(; begin!=end2; ++begin, ++out)
      *out = f(*begin);

    for(; begin!=end3; begin += N, out += N)
      simd::aligned_store(f(simd::load<vT>(begin)), out);

    // epilogue
    for(; begin!=end; ++begin, ++out)
      *out = f(*begin);

    return out;
  }
コード例 #6
0
ファイル: algorithm.hpp プロジェクト: sschaetz/nt2
  U* transform(T1 const* begin1, T1 const* end, T2 const* begin2, U* out, BinOp f)
  {
    typedef boost::simd::native<T1, BOOST_SIMD_DEFAULT_EXTENSION> vT1;
    typedef boost::simd::native<T2, BOOST_SIMD_DEFAULT_EXTENSION> vT2;
    typedef boost::simd::native<U, BOOST_SIMD_DEFAULT_EXTENSION> vU;

    BOOST_MPL_ASSERT_MSG( vT1::static_size == vT2::static_size && vT1::static_size == vU::static_size
                        , BOOST_SIMD_TRANSFORM_INPUT_OUTPUT_NOT_SAME_SIZE
                        , (T1, T2, U)
                        );

    static const std::size_t N = vU::static_size;

    std::size_t shift = simd::align_on(out, N * sizeof(U)) - out;
    T1 const* end2 = begin1 + shift;
    T1 const* end3 = end2 + (end - end2)/N*N;

    // prologue
    for(; begin1!=end2; ++begin1, ++begin2, ++out)
      *out = f(*begin1, *begin2);

    for(; begin1!=end3; begin1 += N, begin2 += N, out += N)
      simd::aligned_store(f(simd::load<vT1>(begin1), simd::load<vT2>(begin2)), out);

    // epilogue
    for(; begin1!=end; ++begin1, ++begin2, ++out)
      *out = f(*begin1, *begin2);

    return out;
  }
コード例 #7
0
ファイル: algorithm.hpp プロジェクト: LarsHadidi/BDSim
  U accumulate(T const* begin, T const* end, U init, F f)
  {
    typedef boost::simd::native<T, BOOST_SIMD_DEFAULT_EXTENSION> vT;
    typedef boost::simd::native<U, BOOST_SIMD_DEFAULT_EXTENSION> vU;

    BOOST_MPL_ASSERT_MSG( vT::static_size == vU::static_size
                        , BOOST_SIMD_ACCUMULATE_INPUT_OUTPUT_NOT_SAME_SIZE
                        , (T, U)
                        );

    static const std::size_t N = vT::static_size;

    T const* end2 = simd::align_on(begin, N * sizeof(T));
    T const* end3 = end2 + (end - end2)/N*N;

    vU cur = simd::splat<vU>(init);

    // prologue
    for(; begin!=end2; ++begin)
      init = f(init, *begin);

    for(; begin!=end3; begin += N)
      cur = f(cur, boost::simd::aligned_load<vT>(begin));

    // reduce cur
    for(typename vU::const_iterator b = cur.begin(); b != cur.end(); ++b)
      init = f(init, *b);

    // epilogue
    for(; begin!=end; ++begin)
      init = f(init, *begin);

    return init;
  }
コード例 #8
0
ファイル: options.hpp プロジェクト: JanVogelgesang/nt2
 Opts const& operator[](Opts const& opts) const
 {
   BOOST_MPL_ASSERT_MSG( (boost::proto::matches<Opts, option_pack>::value)
                       , NT2_UNKNOWN_NAMED_OPTIONS
                       , (Opts)
                       );
   return opts;
 }
コード例 #9
0
    assert_equal_types()
    {
        static const bool are_same =
            boost::is_same<DefaultResult, ExpectedResult>::type::value;

        BOOST_MPL_ASSERT_MSG((are_same),
                             WRONG_DEFAULT_DISTANCE_RESULT,
                             (types<DefaultResult, ExpectedResult>));
    }
コード例 #10
0
ファイル: indexable.hpp プロジェクト: boostorg/geometry
inline Indexable const& indexable_prevent_any_type(V const& )
{
    BOOST_MPL_ASSERT_MSG(
        (false),
        UNEXPECTED_TYPE,
        (V)
    );
    return Indexable();
}
コード例 #11
0
inline R difference(T const& from, T const& to)
{
    BOOST_MPL_ASSERT_MSG(!boost::is_unsigned<R>::value, RESULT_CANT_BE_UNSIGNED, (R));

    typedef ::boost::mpl::bool_<
        boost::is_unsigned<T>::value
    > is_unsigned;

    return difference_dispatch<R>(from, to, is_unsigned());
}
コード例 #12
0
    inline detail::match_manip<Expr, Attribute, Skipper>
    phrase_match(Expr const& xpr, Attribute& p, Skipper const& s)
    {
        typedef
            spirit::traits::is_component<qi::domain, Expr>
        expr_is_component;
        typedef
            spirit::traits::is_component<qi::domain, Skipper>
        skipper_is_component;

        // report invalid expression errors as early as possible
        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
            xpr_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper));

        BOOST_MPL_ASSERT_MSG(skipper_is_component::value,
            skipper_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper));

        return qi::detail::match_manip<Expr, Attribute, Skipper>(xpr, p, s);
    }
コード例 #13
0
ファイル: disjoint.hpp プロジェクト: VTREEM/IFCPlusPlus_old
    static inline bool apply(Point const& p, NSphere const& s)
    {
        typedef typename coordinate_system<Point>::type p_cs;
        typedef typename coordinate_system<NSphere>::type s_cs;
        static const bool check_cs = ::boost::is_same<p_cs, cs::cartesian>::value && ::boost::is_same<s_cs, cs::cartesian>::value;
        BOOST_MPL_ASSERT_MSG(check_cs, NOT_IMPLEMENTED_FOR_THOSE_COORDINATE_SYSTEMS, (p_cs, s_cs));

        return get_radius<0>(s) * get_radius<0>(s)
               <   geometry::comparable_distance(p, center_view<const NSphere>(s));
    }
コード例 #14
0
ファイル: spar.cpp プロジェクト: LocutusOfBorg/poedit
int test_main(int, char* [])
{
    typedef par::proj_aea proj;
    typedef par::ellps_clrk80 ellps;
    typedef par::datum_ire65 datum;
    typedef par::o_proj<par::proj_tmerc> o_proj;
    typedef par::guam guam;

    BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::proj_traits>::pred<proj>::value),
                         PROJ, (proj));
    BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::proj_traits>::pred<int>::value),
                         NOT_PROJ, (int));

    BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::ellps_traits>::pred<ellps>::value),
                         ELLPS, (ellps));
    BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::ellps_traits>::pred<int>::value),
                         NOT_ELLPS, (int));

    BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::datum_traits>::pred<datum>::value),
                         DATUM, (datum));
    BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::datum_traits>::pred<int>::value),
                         NOT_DATUM, (int));

    BOOST_MPL_ASSERT_MSG((par::detail::is_param_t<par::o_proj>::pred<o_proj>::value),
                         O_PROJ, (o_proj));
    BOOST_MPL_ASSERT_MSG((!par::detail::is_param_t<par::o_proj>::pred<int>::value),
                         NOT_O_PROJ, (int));

    BOOST_MPL_ASSERT_MSG((par::detail::is_param<par::guam>::pred<guam>::value),
                         GUAM, (guam));
    BOOST_MPL_ASSERT_MSG((!par::detail::is_param<par::guam>::pred<int>::value),
                         NOT_GUAM, (int));

    typedef par::parameters<proj, ellps, datum, o_proj, guam> params;
    typedef par::parameters<proj, ellps> params_e;
    typedef par::parameters<proj, datum> params_d;
    typedef par::parameters<proj> params_0;

    boost::ignore_unused<params, params_e, params_d, params_0>();

    return 0;
}
コード例 #15
0
    inline detail::match_manip<Expr, Attribute>
    match(Expr const& xpr, Attribute& p)
    {
        typedef spirit::traits::is_component<qi::domain, Expr> is_component;

        // report invalid expression error as early as possible
        BOOST_MPL_ASSERT_MSG(is_component::value,
            xpr_is_not_convertible_to_a_parser, (Expr, Attribute));

        return qi::detail::match_manip<Expr, Attribute>(xpr, p, unused);
    }
コード例 #16
0
ファイル: main.cpp プロジェクト: CCJY/coliru
        F operator()(Context context, F f)
        {
            BOOST_MPL_ASSERT_MSG
            (
                (boost::fusion::result_of::has_key<Context, Variable>::type::value),
                WRONG_VARIABLE_NAME_IN_FORMAT_STRING,
                (Variable)
            );

            f( *boost::fusion::at_key<Variable>(context) );
            return f;
        }
コード例 #17
0
  void run() const
  {
    // IF COMPILATION FAILS HERE: the expression passed to for_each_element is invalid
    BOOST_MPL_ASSERT_MSG(
      (boost::proto::matches<ExprT, ElementGrammar>::value),
      INVALID_ELEMENT_EXPRESSION,
      (ElementGrammar));

    DataT data(variables, elements);

    ElementLooperImpl<DataT>()(expression, data, elements.size());
  }
コード例 #18
0
        static void apply(ApplyMethod)
        {
            // 1) inspect and define both arguments of apply
            typedef typename parameter_type_of
                <
                    ApplyMethod, 0
                >::type ptype;

            typedef typename parameter_type_of
                <
                    ApplyMethod, 1
                >::type sptype;

            namespace services = strategy::distance::services;
            // 2) must define meta-function "tag"
            typedef typename services::tag<Strategy>::type tag;

            BOOST_MPL_ASSERT_MSG
                ((boost::is_same
                      <
                          tag, strategy_tag_distance_point_segment
                      >::value),
                 INCORRECT_STRATEGY_TAG,
                 (types<tag>));

            // 3) must define meta-function "return_type"
            typedef typename services::return_type
                <
                    Strategy, ptype, sptype
                >::type rtype;

            // 4) must define meta-function "comparable_type"
            typedef typename services::comparable_type<Strategy>::type ctype;

            // 5) must implement apply with arguments
            Strategy *str = 0;
            ptype *p = 0;
            sptype *sp1 = 0;
            sptype *sp2 = 0;

            rtype r = str->apply(*p, *sp1, *sp2);

            // 6) must define (meta-)struct "get_comparable" with apply
            ctype cstrategy = services::get_comparable<Strategy>::apply(*str);

            // 7) must define (meta-)struct "result_from_distance" with apply
            r = services::result_from_distance
                <
                    Strategy, ptype, sptype
                >::apply(*str, rtype(1.0));

            boost::ignore_unused(str, r, cstrategy);
        }
コード例 #19
0
ファイル: disjoint.hpp プロジェクト: VTREEM/IFCPlusPlus_old
    static inline bool apply(NSphere const& s, Box const& b)
    {
        typedef typename coordinate_system<Box>::type b_cs;
        typedef typename coordinate_system<NSphere>::type s_cs;
        static const bool check_cs = ::boost::is_same<b_cs, cs::cartesian>::value && ::boost::is_same<s_cs, cs::cartesian>::value;
        BOOST_MPL_ASSERT_MSG(check_cs, NOT_IMPLEMENTED_FOR_THOSE_COORDINATE_SYSTEMS, (b_cs, s_cs));

        return get_radius<0>(s) * get_radius<0>(s)
               <   geometry::detail::disjoint::box_nsphere_comparable_distance_cartesian<
                       Box, NSphere, 0, DimensionCount
                   >::apply(b, s);
    }
コード例 #20
0
ファイル: switch.hpp プロジェクト: 0xDEC0DE8/mcsema
 typename expression::switch_<
     Cond
   , Cases
 >::type
 generate(Cases const &, mpl::false_) const
 {
     BOOST_MPL_ASSERT_MSG(
         false
       , INVALID_SWITCH_CASE_STATEMENT
       , (Cases)
     );
 }
コード例 #21
0
ファイル: action_support.hpp プロジェクト: Stevejohntest/hpx
 char const* get_action_name()
 {
     /// If you encounter this assert while compiling code, that means that
     /// you have a HPX_REGISTER_ACTION macro somewhere in a source file,
     /// but the header in which the action is defined misses a
     /// HPX_REGISTER_ACTION_DECLARATION
     BOOST_MPL_ASSERT_MSG(
         traits::needs_guid_initialization<Action>::value
       , HPX_REGISTER_ACTION_DECLARATION_MISSING
       , (Action)
     );
     return util::type_id<Action>::typeid_.type_id();
 }
コード例 #22
0
ファイル: disjoint.hpp プロジェクト: VTREEM/IFCPlusPlus_old
    static inline bool apply(NSphere1 const& s1, NSphere2 const& s2)
    {
        typedef typename coordinate_system<NSphere1>::type s1_cs;
        typedef typename coordinate_system<NSphere2>::type s2_cs;
        static const bool check_cs = ::boost::is_same<s1_cs, cs::cartesian>::value && ::boost::is_same<s2_cs, cs::cartesian>::value;
        BOOST_MPL_ASSERT_MSG(check_cs, NOT_IMPLEMENTED_FOR_THOSE_COORDINATE_SYSTEMS, (s1_cs, s2_cs));

        /*return get_radius<0>(s1) + get_radius<0>(s2)
               <   ::sqrt(geometry::comparable_distance(center_view<NSphere>(s1), center_view<NSphere>(s2)));*/

        return get_radius<0>(s1) * get_radius<0>(s1) + 2 * get_radius<0>(s1) * get_radius<0>(s2) + get_radius<0>(s2) * get_radius<0>(s2)
               <   geometry::comparable_distance(center_view<const NSphere1>(s1), center_view<const NSphere2>(s2));
    }
コード例 #23
0
  void operator() (const ETYPE& sf) const
  {

    BOOST_MPL_ASSERT_MSG(
          ETYPE::order > 0
        , ZERO_ORDER_SUPPORT_NOT_ALLOWED
        , (ETYPE)
        );

    if(!mesh::IsElementType<ETYPE>()(m_elements.element_type()))
      return;

    dispatch(boost::mpl::int_<boost::mpl::size< boost::mpl::filter_view< ElementTypesT, mesh::IsCompatibleWith<ETYPE> > >::value>(), sf);
  }
コード例 #24
0
    inline static bool 
    left_align_generate(OutputIterator& sink, Context& ctx, 
        Delimiter const& d, Parameter const& param, Embedded const& e, 
        unsigned int const width, Padding const& p) 
    {
        // make sure all generator parameters are valid
        BOOST_MPL_ASSERT_MSG(
            (spirit::traits::is_component<karma::domain, Embedded>::value), 
            embedded_is_not_convertible_to_a_generator, (Context, Embedded));

        BOOST_MPL_ASSERT_MSG(
            (spirit::traits::is_component<karma::domain, Padding>::value), 
            padding_is_not_convertible_to_a_generator, (Context, Padding));
            
        typedef 
            typename result_of::as_component<karma::domain, Embedded>::type 
        embedded;
        typedef 
            typename result_of::as_component<karma::domain, Padding>::type 
        padding;

        // wrap the given output iterator to allow counting
        detail::enable_counting<OutputIterator> counting(sink);
        
        // first generate the underlying output 
        embedded ec = spirit::as_component(karma::domain(), e);
        typedef typename embedded::director director;
        bool r = director::generate(ec, sink, ctx, d, param);

        // pad the output until the max width is reached
        padding pc = spirit::as_component(karma::domain(), p);
        while(r && sink.count() < width) {
            typedef typename padding::director padding_director;
            r = padding_director::generate(pc, sink, ctx, unused, unused);
        }
        return r;
    }
コード例 #25
0
    inline bool
    generate(detail::output_iterator<OutputIterator>& sink, Expr const& xpr)
    {
        typedef spirit::traits::is_component<karma::domain, Expr> is_component;

        // report invalid expression error as early as possible
        BOOST_MPL_ASSERT_MSG(is_component::value,
            xpr_is_not_convertible_to_a_generator, 
            (OutputIterator, Expr));

        typedef
            typename result_of::as_component<karma::domain, Expr>::type
        component;
        typedef typename component::director director;

        component c = spirit::as_component(karma::domain(), xpr);
        return director::generate(c, sink, unused, unused, unused);
    }
コード例 #26
0
ファイル: serialization.hpp プロジェクト: KWMalik/nt2
 void save( Archive& ar, const nt2::container::expression<E,R,D>& e
          , unsigned int const& version
          , typename boost::enable_if< typename boost::mpl::equal_to<
              typename boost::proto::arity_of<E>
            , boost::mpl::int_<0> >
            >::type* dummy = 0
          )
 {
   BOOST_MPL_ASSERT_MSG( (boost::proto::arity_of<E>::value == 0)
                       , NT2_INVALID_ACCESS_TO_RAW_DATA_ON_NON_TERMINAL
                       , (E)
                       );
   typedef typename nt2::container::expression<E,R,D>::extent_type e_t;
   typedef typename nt2::meta::strip<e_t>::type size_type;
   size_type size_ = e.extent();
   ar << size_;
   ar << make_array(e.raw(), nt2::numel(e));
 }
コード例 #27
0
ファイル: serialization.hpp プロジェクト: KWMalik/nt2
  void save( Archive& ar, const nt2::container::expression<E,R,D>& e
           , unsigned int const& version
           , typename boost::enable_if< typename boost::mpl::not_equal_to<
               typename boost::proto::arity_of<E>
             , boost::mpl::int_<0> >
             >::type* dummy = 0
           )
  {
   BOOST_MPL_ASSERT_MSG( (boost::proto::arity_of<E>::value != 0)
                        ,  NT2_INVALID_ACCESS_TO_EXPRESSION_NODES_ON_NON_EXPRESSION
                        , (E)
                        );

    typedef typename proto::result_of::
    flatten< const nt2::container::expression<E,R,D> >::type sequence_type;
    saver_<Archive> save_terminals_(ar);
    sequence_type terminals = boost::proto::flatten(e);
    boost::fusion::for_each(terminals,save_terminals_);
  }
コード例 #28
0
inline typename result_of::matrix_product_element
<
Matrix1
, Matrix2
, Row
, Column
>::type matrix_product_element( const Matrix1& m1, const Matrix2& m2 )
{
    GEOMETRIX_STATIC_ASSERT( is_matrix<Matrix1>::value );
    GEOMETRIX_STATIC_ASSERT( is_matrix<Matrix2>::value );
    BOOST_MPL_ASSERT_MSG
    (
        boost::mpl::bool_< ( column_dimension_of<Matrix1>::value == row_dimension_of<Matrix2>::value ) >::value
        , MATRIX_DIMENSIONS_SUPPLIED_TO_MATRIX_PRODUCT_ARE_NOT_COMPATIBLE
        , (std::pair<Matrix1, Matrix2>)
    );

    return dot_product( row<Matrix1,Row>( m1 ), column<Matrix2, Column>( m2 ) );
}
コード例 #29
0
inline std::basic_ostream<Char, Traits> &operator <<
(
    std::basic_ostream<Char, Traits> &sout
    , sub_match<BidiIter> const &sub
)
{
    typedef typename iterator_value<BidiIter>::type char_type;
    BOOST_MPL_ASSERT_MSG(
        (boost::is_same<Char, char_type>::value)
        , CHARACTER_TYPES_OF_STREAM_AND_SUB_MATCH_MUST_MATCH
        , (Char, char_type)
    );
    if(sub.matched)
    {
        std::ostream_iterator<char_type, Char, Traits> iout(sout);
        std::copy(sub.first, sub.second, iout);
    }
    return sout;
}
コード例 #30
0
    inline bool
    generate(OutputIterator target_sink, Expr const& xpr, Parameter const& param)
    {
        typedef spirit::traits::is_component<karma::domain, Expr> is_component;

        // report invalid expression error as early as possible
        BOOST_MPL_ASSERT_MSG(is_component::value,
            xpr_is_not_convertible_to_a_generator, 
            (OutputIterator, Expr, Parameter));

        // wrap user supplied iterator into our own output iterator
        detail::output_iterator<OutputIterator> sink(target_sink);
        
        typedef
            typename result_of::as_component<karma::domain, Expr>::type
        component;
        typedef typename component::director director;

        component c = spirit::as_component(karma::domain(), xpr);
        return director::generate(c, sink, unused, unused, param);
    }