Tatooine
is_cacheable.h
Go to the documentation of this file.
1#ifndef TATOOINE_IS_CACHEABLE_H
2#define TATOOINE_IS_CACHEABLE_H
3//==============================================================================
4#include <type_traits>
5//==============================================================================
6namespace tatooine {
7//==============================================================================
8template <typename T, typename Void = void>
9struct is_cacheable_impl : std::false_type {};
10//------------------------------------------------------------------------------
11template <typename T>
12struct is_cacheable_impl<T, std::void_t<decltype(&T::use_caching)>>
13 : std::true_type {};
14//------------------------------------------------------------------------------
15template <typename T>
17//------------------------------------------------------------------------------
18template <typename T>
19constexpr auto is_cacheable() {
20 return is_cacheable_v<T>;
21}
22//------------------------------------------------------------------------------
23template <typename T>
24constexpr auto is_cacheable(T&&) {
25 return is_cacheable_v<std::decay_t<T>>;
26}
27//==============================================================================
28} // namespace tatooine
29//==============================================================================
30#endif
Definition: algorithm.h:6
constexpr auto is_cacheable()
Definition: is_cacheable.h:19
static constexpr auto is_cacheable_v
Definition: is_cacheable.h:16
void void_t
Definition: void_t.h:7
Definition: is_cacheable.h:9