| Home | Libraries | People | FAQ | More

## 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 Random Access Sequence.

## Synopsis

    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);

## Description

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 in order the domains of the elements of `sequence` and taking the first that is not ``proto::default_domain``, if any such domain exists, or ``proto::default_domain`` otherwise.

Let ``WRAP`<N>(s)`, where `s` has type `S`, be defined such that:

- If `fusion::value_at<S,N>::type` is a reference, ``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))`.

Let ``MAKE`<Tag>(a...)` be defined as ``proto::expr`<Tag, `proto::listN`<A...> >::make(a...)` where `Ax` is the type of `ax`.

Parameters: |
`sequence` | A Fusion Random Access Sequence.
Returns: | `Domain()(`MAKE`<Tag>(`WRAP`<0>(s),... `WRAP`<`N`-1>(s)))`, where `N` is the size of `Sequence`.