STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
stapl::static_match< Choice, Options > Struct Template Reference

Statically choose a type from a list of options. More...

Detailed Description

template<typename Choice, typename Options>
struct stapl::static_match< Choice, Options >

Statically choose a type from a list of options.

A choice is a tuple of types (either true_type or false_type) and the options are a tuple of pairs, where the first element of the pair is a possible choice (tuple of true_type, false_type or dont_care) and the second element is the final type that should be emitted.

For example, options can be the following: tuple< pair<tuple<true_type , false_type>, foo>, pair<tuple<true_type , true_type >, bar>, pair<tuple<false_type, dont_care >, baz> >

Which means if given (T, F) emit the type foo, if given (T, T), emit the type bar and if given (F, ?), emit the type baz.

Example with the above options:

static_match<tuple<false_type, true_type>, Opts>::type == baz

Reflects the trait "type" that corresponds to the matched choice, or not_matched if no options are matched. Note that the choices are matched sequentially and if there are several possible matches, only the first is returned.


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