| Home | Libraries | People | FAQ | More

## Function template value_as

boost::histogram::axis::traits::value_as — Returns axis value for index if it is convertible to target type or throws.

## Synopsis

    // In header: <boost/histogram/axis/traits.hpp>

    template<typename Result, typename Axis>
      Result value_as(const Axis & axis, real_index_type index);

## Description

Like boost::histogram::axis::traits::value, but converts the result into the requested return type. If the conversion is not possible, throws std::runtime_error.

Parameters:

`axis` | any axis instance
`index` | floating point axis index

Template Parameters:

`Result` | requested return type
`Axis` | axis type