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

Click here to view the latest version of this page.
PrevUpHomeNext
Store an Attribute Value after a Parser Produced a Value (Qi)
assign_to_attribute_from_value

The template assign_to_attribute_from_value is a type used as an attribute customization point. It is invoked by all primitive Qi parsers in order to store a parsed attribute value into the attribute instance provided by the user, if this attribute is not a container type (is_container<T>::type evaluates to mpl::false_, where T is the attribute type).

Module Headers
#include <boost/spirit/home/qi/detail/assign_to.hpp>

Also, see Include Structure.

[Note] Note

This header file does not need to be included directly by any user program as it is normally included by other Spirit header files relying on its content.

Namespace

Name

boost::spirit::traits

Synopsis
template <typename Attrib, typename T, typename Enable>
struct assign_to_attribute_from_value
{
    static void call(T const& val, Attrib& attr);
};
Template parameters

Parameter

Description

Default

Attrib

The type, Attrib is the type of the attribute as passed in by the user. This type is not a container type (is_container<Attrib>::type evaluates to mpl::false_).

none

T

The type, T is the type of the attribute instance as produced by the parser.

none

Enable

Helper template parameter usable to selectively enable or disable certain specializations of assign_to_attribute_from_value utilizing SFINAE (i.e. boost::enable_if or boost::disable_if).

void

Notation

Attrib

A type to be used as the target to store the attribute value in. This type is guaranteed not to be a container type (is_container<Attrib>::type evaluates to mpl::false_).

attr

An attribute instance of type Attrib.

T

A type as produced by the parser. The parser temporarily stores its parsed values using this type.

t

An attribute instance of type T.

Expression Semantics

Expression

Semantics

assign_to_attribute_from_value<Attrib, T>::call(t, attr)

Copy (assign) the value t to the attribute attr.

Predefined Specializations

Template Parameters

Semantics

Attrib, T

Assign the argument t to attr.

unused_type, T

Do nothing.

When to implement

The customization point assign_to_attribute_from_value needs to be implemented for a specific type whenever the default implementation as shown above is not applicable. Examples for this could be that the type Attrib is not copy constructible.


PrevUpHomeNext