iffl  1.3.4
Implements Intrusive Flat Forward List container
iffl_mpl.h
Go to the documentation of this file.
1 #pragma once
2 
173 #include <iffl_config.h>
174 #include <type_traits>
175 
180 namespace iffl::mpl {
181 
187 template <typename... Whatever >
188 using void_t = std::void_t<Whatever ...>;
189 
196 struct nonesuch {
200  nonesuch() = delete;
204  ~nonesuch() = delete;
208  nonesuch(nonesuch const &) = delete;
212  nonesuch const &operator=(nonesuch const &) = delete;
213 };
214 
219 namespace details {
264  template<typename Default,
265  typename AlwaysVoid,
266  template<typename... > typename Operation,
267  typename... Arguments>
268  struct detector {
272  using value_type = std::false_type;
277  using type = Default;
278  };
298  template<typename Default,
299  template<typename... > typename Operation,
300  typename... Arguments>
301  struct detector<Default,
302  void_t<Operation<Arguments...>>,
303  Operation,
304  Arguments... > {
308  using value_type = std::true_type;
313  using type = Operation<Arguments...>;
314  };
315 
316 } // namespace details
317 
329 template <template <typename... > typename Operation,
330  typename... Arguments>
331 using is_detected =
332  typename details::detector <nonesuch,
333  void,
334  Operation,
335  Arguments...>::value_type;
336 
349 template <template <typename... > typename Operation,
350  typename... Arguments>
351 using is_detected_t = is_detected<Operation, Arguments...>;
352 
361 template <template <typename... > typename Operation,
362  typename... Arguments>
363 constexpr auto const is_detected_v{ is_detected<Operation, Arguments...>{} };
364 
377 template <template <typename... > typename Operation,
378  typename... Arguments>
379 using detected_t =
380  typename details::detector <nonesuch,
381  void,
382  Operation,
383  Arguments...>::type;
392 template <template <typename... > typename Operation,
393  typename... Arguments>
394 constexpr auto const detected_v{ detected_t<Operation, Arguments...>{} };
395 
406 template <typename Default,
407  template <typename... > typename Operation,
408  typename... Arguments>
409 using detected_or =
410  details::detector <Default,
411  void,
412  Operation,
413  Arguments...>;
424 template <typename Default,
425  template <typename... > typename Operation,
426  typename... Arguments>
427 using detected_or_t = typename detected_or<Default, Operation, Arguments...>::type;
435 template <typename Default,
436  template <typename... > typename Operation,
437  typename... Arguments>
438 constexpr auto const detected_or_v{ typename detected_or<Default, Operation, Arguments...>::type{} };
449 template <typename ExpectedType,
450  template <typename... > typename Operation,
451  typename... Arguments>
452 using is_detected_exact =
453  std::is_same<ExpectedType,
454  detected_t<Operation,
455  Arguments... >>;
463 template <typename ExpectedType,
464  template <typename... > typename Operation,
465  typename... Arguments>
466 constexpr auto const is_detected_exact_v{ is_detected_exact<ExpectedType, Operation, Arguments...>{} };
477 template <typename ConvertibleToType,
478  template <typename... > typename Operation,
479  typename... Arguments>
481  std::is_convertible<detected_t<Operation,
482  Arguments... >,
483  ConvertibleToType>;
491 template <typename ConvertibleToType,
492  template <typename... > typename Operation,
493  typename... Arguments>
494 constexpr auto const is_detected_convertible_v{ is_detected_convertible<ConvertibleToType, Operation, Arguments...>{} };
495 
496 } //namespace iffl::mpl;
Operation< Arguments... > type
In this template specialization it is type of meta-function Operation<Arguments......
Definition: iffl_mpl.h:313
constexpr auto const is_detected_v
Instance of is_detected meta-function output.
Definition: iffl_mpl.h:363
constexpr auto const is_detected_exact_v
instance of is_detected_exact<...>::value
Definition: iffl_mpl.h:466
This file is supposed to be generated by cmake. Cmake pushes output to the folder where it generates ...
defines detector meta-function
Definition: iffl_mpl.h:268
intrusive flat forward list
constexpr auto const detected_v
Instance of detected_t meta-function output.
Definition: iffl_mpl.h:394
nonesuch()=delete
type cannot be instantiated
typename details::detector< nonesuch, void, Operation, Arguments... >::type detected_t
is_detected will be either true_type or false_type, depending if Operation<Arguments....
Definition: iffl_mpl.h:383
is_detected< Operation, Arguments... > is_detected_t
alias for is_detected
Definition: iffl_mpl.h:351
typename detected_or< Default, Operation, Arguments... >::type detected_or_t
Extracts and return detector<...>::type of detected_or.
Definition: iffl_mpl.h:427
~nonesuch()=delete
type cannot be instantiated
A valid type that cannot be instantiate. Used by some detector meta-functions as a default type.
Definition: iffl_mpl.h:196
std::is_convertible< detected_t< Operation, Arguments... >, ConvertibleToType > is_detected_convertible
returns std::true_type when result of meta-function detected_t is the convertible to ConvertibleToTyp...
Definition: iffl_mpl.h:483
std::true_type value_type
In this template specialization it is always true_type.
Definition: iffl_mpl.h:308
std::false_type value_type
In this template specialization it is always false_type.
Definition: iffl_mpl.h:272
details::detector< Default, void, Operation, Arguments... > detected_or
type of detector Operation<Arguments...> if it is well formed, and otherwise Default type
Definition: iffl_mpl.h:413
std::void_t< Whatever ... > void_t
Type that can take any number of template parameters and returns void. It is used by detector meta-fu...
Definition: iffl_mpl.h:188
constexpr auto const detected_or_v
instance of detector<...>::type of detected_or
Definition: iffl_mpl.h:438
Default type
In this template specialization it is Default type.
Definition: iffl_mpl.h:277
std::is_same< ExpectedType, detected_t< Operation, Arguments... > > is_detected_exact
returns std::true_type when result of meta-function detected_t is the same as ExpectedType
Definition: iffl_mpl.h:455
constexpr auto const is_detected_convertible_v
instance of the is_detected_convertible
Definition: iffl_mpl.h:494
typename details::detector< nonesuch, void, Operation, Arguments... >::value_type is_detected
is_detected will be either true_type or false_type, depending if Operation<Arguments....
Definition: iffl_mpl.h:335
nonesuch const & operator=(nonesuch const &)=delete
type cannot be instantiated