Boost C++ Libraries

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

PrevUpHomeNext

Struct template literal

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

Synopsis

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

template<typename T, typename Domain = proto::default_domain> 
struct literal :  
  proto::extends<proto::basic_expr<proto::tag::terminal, proto::term< T > >, proto::literal<T, Domain>, Domain>
{
  // types
  typedef proto::basic_expr<proto::tag::terminal, proto::term< T > > 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
  literal();
  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. literal();
  2. template<typename U> literal(U & u);
  3. template<typename U> literal(U const & u);
  4. 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)

PrevUpHomeNext