• Docs >
  • Program Listing for File functional_traits.hpp
Shortcuts

Program Listing for File functional_traits.hpp

Return to documentation for file (include/ripple/functional/functional_traits.hpp)

#ifndef RIPPLE_FUNCTIONAL_FUNCTIONAL_TRAITS_HPP
#define RIPPLE_FUNCTIONAL_FUNCTIONAL_TRAITS_HPP

#include <ripple/utility/portability.hpp>

namespace ripple {

/*==--- [forward declarations] ---------------------------------------------==*/

template <typename Functor>
class Invocable;

/*==--- [traits helpers] ---------------------------------------------------==*/

namespace detail {

template <typename T>
struct IsInvocable {
  static constexpr bool value = false;
};

template <typename F>
struct IsInvocable<Invocable<F>> {
  static constexpr bool value = true;
};

} // namespace detail

template <typename T>
static constexpr auto is_invocable_v =
  detail::IsInvocable<std::decay_t<T>>::value;

template <typename T>
using make_invocable_t = std::
  conditional_t<is_invocable_v<std::decay_t<T>>, T, Invocable<std::decay_t<T>>>;

} // namespace ripple

#endif // RIPPLE_FUNCTIONAL_FUNCTIONAL_TRAITS_HPP

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples