Home | History | Annotate | Download | only in rpc

Lines Matching defs:TypeTag

19 struct TypeTag {};
27 using TypeTagForIndex = TypeTag<TypeForIndex<I, Types...>>;
140 Union(std::int32_t index, std::int32_t* index_out, TypeTag<Type>, T&& value)
162 Type& get(TypeTag<Type>) { return first_; }
163 const Type& get(TypeTag<Type>) const { return first_; }
164 EmptyVariant get(TypeTag<EmptyVariant>) const { return {}; }
165 constexpr std::int32_t index(TypeTag<Type>) const { return 0; }
168 std::int32_t Construct(TypeTag<Type>, Args&&... args) {
179 if (target_index == index(TypeTag<Type>{})) {
180 (&get(TypeTag<Type>{}))->~Type();
185 bool Assign(TypeTag<Type>, std::int32_t target_index, T&& value) {
211 if (target_index == index(TypeTag<Type>{}))
212 return std::forward<Op>(op)(get(TypeTag<Type>{}));
214 return std::forward<Op>(op)(get(TypeTag<EmptyVariant>{}));
218 if (target_index == index(TypeTag<Type>{}))
219 return std::forward<Op>(op)(get(TypeTag<Type>{}));
221 return std::forward<Op>(op)(get(TypeTag<EmptyVariant>{}));
226 if (target_index == index(TypeTag<Type>{})) {
227 Construct(TypeTag<Type>{}, std::forward<Args>(args)...);
245 Union(std::int32_t index, std::int32_t* index_out, TypeTag<First>, T&& value)
250 Union(std::int32_t index, std::int32_t* index_out, TypeTag<T>, U&& value)
251 : rest_(index + 1, index_out, TypeTag<T>{}, std::forward<U>(value)) {}
289 First& get(TypeTag<First>) { return first_; }
290 const First& get(TypeTag<First>) const { return first_; }
291 constexpr std::int32_t index(TypeTag<First>) const { return 0; }
294 T& get(TypeTag<T>) {
295 return rest_.template get(TypeTag<T>{});
298 const T& get(TypeTag<T>) const {
299 return rest_.template get(TypeTag<T>{});
302 constexpr std::int32_t index(TypeTag<T>) const {
303 return 1 + rest_.template index(TypeTag<T>{});
307 std::int32_t Construct(TypeTag<First>, Args&&... args) {
312 std::int32_t Construct(TypeTag<T>, Args&&... args) {
314 rest_.template Construct(TypeTag<T>{}, std::forward<Args>(args)...);
330 if (target_index == index(TypeTag<First>{})) {
331 (get(TypeTag<First>{})).~First();
338 bool Assign(TypeTag<First>, std::int32_t target_index, T&& value) {
347 bool Assign(TypeTag<T>, std::int32_t target_index, U&& value) {
348 return rest_.Assign(TypeTag<T>{}, target_index - 1, std::forward<U>(value));
372 if (target_index == index(TypeTag<First>{}))
373 return std::forward<Op>(op)(get(TypeTag<First>{}));
379 if (target_index == index(TypeTag<First>{}))
380 return std::forward<Op>(op)(get(TypeTag<First>{}));
387 if (target_index == index(TypeTag<First>{})) {
388 Construct(TypeTag<First>{}, std::forward<Args>(args)...);
411 using TypeTag = detail::TypeTag<T>;
413 using DecayedTypeTag = TypeTag<std::decay_t<T>>;
621 void Assign(TypeTag<T>, U&& value) {
622 if (!value_.template Assign(TypeTag<T>{}, index_, std::forward<U>(value))) {
624 Construct(TypeTag<T>{}, std::forward<U>(value));