Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::AllAttrs Struct Reference

A helper to manipulate the list of attributes. More...

#include <derived_data.h>

Public Types

template<int i>
using TypeDescriptor = std::tuple_element_t<i, AllAttrTypeDescriptors>
 Returns the descriptor of the i-th attribute type in the list.
template<int i>
using Type = typename TypeDescriptor<i>::AttrType
 Returns the i-th attribute type in the list.

Static Public Member Functions

template<typename AttrT>
static constexpr int GetIndex ()
template<typename Fn>
static void ForEachAttr (Fn &&fn)

Static Public Attributes

static constexpr int kNumAttrTypes
 The number of available attribute types.

Detailed Description

A helper to manipulate the list of attributes.

Definition at line 33 of file derived_data.h.

Member Typedef Documentation

◆ Type

template<int i>
using operations_research::math_opt::AllAttrs::Type = typename TypeDescriptor<i>::AttrType

Returns the i-th attribute type in the list.

Definition at line 44 of file derived_data.h.

◆ TypeDescriptor

template<int i>
using operations_research::math_opt::AllAttrs::TypeDescriptor = std::tuple_element_t<i, AllAttrTypeDescriptors>

Returns the descriptor of the i-th attribute type in the list.

Definition at line 40 of file derived_data.h.

Member Function Documentation

◆ ForEachAttr()

template<typename Fn>
void operations_research::math_opt::AllAttrs::ForEachAttr ( Fn && fn)
inlinestatic

Applies fn on each value for each attribute type. fn must have a overload set of operator(AttrType) that accepts a AttrType for each attribute type.

Definition at line 63 of file derived_data.h.

◆ GetIndex()

template<typename AttrT>
constexpr int operations_research::math_opt::AllAttrs::GetIndex ( )
inlinestaticconstexpr

Returns the index of attribute type AttrT. Fails to compile if AttrT is not an attribute.

This weird construct is to show AttrT explicitly instead of letting the user fish it out of the stack trace when the static_assert fails.

Definition at line 49 of file derived_data.h.

Member Data Documentation

◆ kNumAttrTypes

int operations_research::math_opt::AllAttrs::kNumAttrTypes
staticconstexpr
Initial value:
=
std::tuple_size_v<AllAttrTypeDescriptors>

The number of available attribute types.

Definition at line 35 of file derived_data.h.


The documentation for this struct was generated from the following file: