Defined in Member types Construction From a value of one alternative in place from arguments or widening from a over a subset of the alternatives Destructor Assignment choice_for The construction alias accepts alternatives in any order with duplicates and nested copacks and resolves to the canonical Prefer it over spelling directly so that no spelling in your project is tied to one compiler s alternative order Deduction guides value The alternatives as the underlying always present and_then transform apply apply_r apply_type apply_type_r The identity carrier over a coproduct always holds one of the alternatives A never failing computation whose result is one of Ts the one canonical spelling of that shape as just over a copack is rejected Where a bare copack is self flattening data a choice is an atom mapping keeps a returned choice whole and only and_then joins the branches choices away into the normalized superset The alternatives obey the same canonical form as copack s flat unique sorted so spell choice_for choice<> is deliberately incomplete an always present alternative needing at least one alternative to exist A structural type when its alternatives are using value_type _impl 1 The copack of alternatives this choice carries template <std size_t I> using select_nth detail select_nth_t<I Ts > 1 The I th alternative in the canonical order static std size_t size sizeof Ts 1 The number of alternatives template <typename T> static constexpr bool has_type _impl template has_type<T> 1 Whether T is one of the alternatives copack template <typename T> constexpr choice T &&v 1 constexpr explicit choice T &&v 2 constexpr explicit choice std in_place_type_t<T> d auto && args 3 template <typename Tx> constexpr choice copack<Tx > const &v 4 constexpr choice copack<Tx > &&v 5 constexpr choice std in_place_type_t<copack<Tx >> some_copack auto &&v 6 constexpr choice choice const &other default 7 constexpr choice choice &&other default 8 Constructs the alternative matching the value s decayed type Explicit exactly where the conversion to that alternative is v T && Value of one alternative Constructs the alternative T in place from the arguments d std in_place_type_t< T > Tag naming the alternative args auto && Arguments to construct the alternative from d std in_place_type_t< T > Tag naming the alternative args auto && Arguments to construct the alternative from Widening constructor from a copack over a subset of the alternatives A copack converts implicitly into any choice that can hold its alternatives the lift from data to the never failing carrier over it v copack < Tx > const & The copack to lift Widening constructor from a copack over a subset of the alternatives Widening constructor from a copack whose type is spelled as a tag v some_copack auto && The copack to lift Copy constructor Move constructor constexpr choice default 1 Destructor constexpr auto operator choice const &other default > choice & 1 constexpr auto operator choice &&other default > choice & 2 template <typename Tx> constexpr auto operator copack<Tx > const &arg > choice & 3 constexpr auto operator copack<Tx > &&arg > choice & 4 template <typename U> constexpr auto operator U &&v > choice & 5 Copy assignment Move assignment Widening assignment from a copack over a subset of the alternatives Widening assignment from a copack over a subset of the alternatives Assignment from a value fn choice choice template <typename Ts> using choice_for detail _collapsing_copack normalized< fn choice detail _collapsing_copack flattened<Ts >> type 1 Builds the canonical choice for any list of types The construction alias over choice exactly as copack_for stands to copack flattens deduplicates and sorts into the canonical order Spell choice_for rather than choice so that no spelling in your project is tied to one compiler s alternative order template <typename T> choice std in_place_type_t<T> auto && > choice<T> 1 choice T > choice<T> 2 copack constexpr auto value & > value_type & 1 constexpr auto value const & > value_type const & 2 constexpr auto value && > value_type && 3 constexpr auto value const && > value_type const && 4 Accesses the alternatives as the underlying copack Always present a choice cannot fail so the access is total never throwing template <typename Fn> constexpr auto and_then Fn &&fn & 1 constexpr auto and_then Fn &&fn const & 2 constexpr auto and_then Fn &&fn && 3 constexpr auto and_then Fn &&fn const && 4 Binds the alternatives every branch returns a choice joined into the superset The member is the carrier s own bind each branch s returned choice splices its alternatives into one normalized superset choice A branch returning a bare value belongs to transform instead and is rejected with a named diagnostic branches converging on another carrier kind belong to the pipeline fn and_then the licensed cross carrier place return The normalized superset choice of the branches alternatives fn Fn && Callable applied on the active alternative fn overload fuses arms into one template <typename Fn> constexpr auto transform Fn &&fn & 1 constexpr auto transform Fn &&fn const & 2 constexpr auto transform Fn &&fn && 3 constexpr auto transform Fn &&fn const && 4 Maps the alternatives the branch results forming a new normalized choice As copack s transform staying a carrier the branch results flatten deduplicate and sort A returned choice stays whole an atom nested as one alternative where a returned bare copack dissolves into the set return A choice of the normalized branch result set holding the active branch s result fn Fn && Callable applied on the active alternative fn overload fuses arms into one template <typename Fn typename Args> constexpr auto apply Fn &&fn Args && args & 1 constexpr auto apply Fn &&fn Args && args const & 2 constexpr auto apply Fn &&fn Args && args && 3 constexpr auto apply Fn &&fn Args && args const && 4 Eliminates the choice the active alternative routes into the callable Exactly copack s apply over the alternatives exhaustive dispatch by ordinary overload resolution one deduced result type a tuple like alternative unpacked one level into its elements trailing arguments after the content return The callable s result fn Fn && Callable applied on the active alternative fn overload fuses arms into one args Args && Additional arguments appended after the alternative s content template <typename T typename Fn typename Args> constexpr auto apply_r Fn &&fn Args && args & 1 constexpr auto apply_r Fn &&fn Args && args const & 2 constexpr auto apply_r Fn &&fn Args && args && 3 constexpr auto apply_r Fn &&fn Args && args const && 4 Eliminates the choice converting each branch s result to T return The callable s result converted to T fn Fn && Callable applied on the active alternative args Args && Additional arguments appended after the alternative s content return The callable s result converted to T fn Fn && Callable applied on the active alternative args Args && Additional arguments appended after the alternative s content template <typename Fn typename Args> constexpr auto apply_type Fn &&fn Args && args & 1 constexpr auto apply_type Fn &&fn Args && args const & 2 constexpr auto apply_type Fn &&fn Args && args && 3 constexpr auto apply_type Fn &&fn Args && args const && 4 Eliminates the choice keyed by the alternative s type The active arm receives std in_place_type<T> for the alternative held followed by its content as copack s apply_type hands it over return The callable s result fn Fn && Callable applied on the tag and the alternative s content args Args && Additional arguments appended after the content template <typename Ret typename Fn typename Args> constexpr auto apply_type_r Fn &&fn Args && args & > Ret 1 constexpr auto apply_type_r Fn &&fn Args && args const & > Ret 2 constexpr auto apply_type_r Fn &&fn Args && args && > Ret 3 constexpr auto apply_type_r Fn &&fn Args && args const && > Ret 4 Eliminates the choice keyed by the alternative s type converting the result to Ret return The callable s result converted to Ret fn Fn && Callable applied on the tag and the alternative s content args Args && Additional arguments appended after the content return The callable s result converted to Ret fn Fn && Callable applied on the tag and the alternative s content args Args && Additional arguments appended after the content