Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function unpack_expr

boost::proto::unpack_expr — Construct an expression of the requested tag type with a domain and with children from the specified Fusion Forward Sequence.


// In header: <boost/proto/make_expr.hpp>

template<typename Tag, typename Sequence> 
  typename proto::result_of::unpack_expr<Tag, Sequence const>::type const 
  unpack_expr(Sequence const & sequence);
template<typename Tag, typename Domain, typename Sequence> 
  typename proto::result_of::unpack_expr<Tag, Domain, Sequence const>::type const 
  unpack_expr(Sequence const & sequence);


This function template may be invoked either with or without specifying a Domain argument. If no domain is specified, the domain is deduced by examining domains of each element of the sequence. See proto::deduce_domain for a full description of the procedure used.

Let s be a Fusion RandomAccessSequence equivalent to sequence. Let WRAP(N, s) be defined such that:

  • If fusion::result_of::value_at_c<decltype(s),N>::type is a reference type or an instantiation of boost::reference_wrapper<>, WRAP(N, s) is equivalent to proto::as_child<Domain>(fusion::at_c<N>(s)).

  • Otherwise, WRAP(N, s) is equivalent to proto::as_expr<Domain>(fusion::at_c<N>(s)).

If proto::wants_basic_expr<typename Domain::proto_generator>::value is true, then let E be proto::basic_expr; otherwise, let E be proto::expr.

Let MAKE(Tag, b...) be defined as E<Tag, proto::listN<decltype(b)...> >::make(b...).

If Tag is proto::tag::terminal, then return WRAP(0, s).

Otherwise, return Domain()(MAKE(Tag, WRAP(0, s),... WRAP(N-1, s))), where N is the size of Sequence.



A Fusion Forward Sequence.