| Home | Libraries | People | FAQ | More

## Struct template literal

boost::proto::literal — A simple wrapper for a terminal, provided for ease of use.

## Synopsis

    template<typename T, typename Domain = proto::default_domain>
    struct literal :
      proto::extends<typename proto::terminal<T>::type, proto::literal<T, Domain>, Domain>
    {
      // types
      typedef typename proto::terminal<T>::type                 X;                // For exposition only
      typedef typename proto::result_of::value<X>::type         value_type;
      typedef typename proto::result_of::value<X &>::type       reference;
      typedef typename proto::result_of::value<X const &>::type const_reference;

      // construct/copy/destruct
      template<typename U> literal(U &);
      template<typename U> literal(U const &);
      template<typename U> literal(proto::literal< U, Domain > const &);

      // public member functions
      reference get();
      const_reference get() const;
    };

## Description

A simple wrapper for a terminal, provided for ease of use. In all cases, `proto::literal<X> l(x);` is equivalent to `proto::terminal<X>::type l = {x};`.

The `Domain` template parameter defaults to `proto::default_domain`.

### `literal` public construct/copy/destruct

1.     template<typename U> literal(U & u);

2.     template<typename U> literal(U const & u);

3.     template<typename U> literal(proto::literal< U, Domain > const & u);

### `literal` public member functions

1.     reference get();

   Returns: | `proto::value(*this)`

2.     const_reference get() const;

   Returns: | `proto::value(*this)`