libcopp
2.2.0
include
libcopp
utils
std
type_traits.h
Go to the documentation of this file.
1
// Copyright 2023 owent
2
3
#pragma once
4
5
#include <libcopp/utils/config/libcopp_build_features.h>
6
7
// clang-format off
8
#include <
libcopp/utils/config/stl_include_prefix.h
>
// NOLINT(build/include_order)
9
// clang-format on
10
#include <functional>
11
#include <memory>
12
#include <type_traits>
13
// clang-format off
14
#include <
libcopp/utils/config/stl_include_suffix.h
>
// NOLINT(build/include_order)
15
// clang-format on
16
17
LIBCOPP_COPP_NAMESPACE_BEGIN
18
namespace
type_traits
{
19
#if (defined(__cplusplus) && __cplusplus >= 201703L) || ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))
20
# define COPP_RETURN_VALUE_DECAY(F, ARG) \
21
typename std::decay<decltype(std::invoke(std::declval<F>(), std::declval<ARG>()))>::type
22
#elif (defined(__cplusplus) && \
23
(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))) || \
24
((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L))
25
# define COPP_RETURN_VALUE_DECAY(F, ARG) typename std::decay<typename std::result_of<F(ARG)>::type>::type
26
#endif
27
28
template
<
class
T>
29
struct
is_shared_ptr
:
public
std::false_type {};
30
template
<
class
T>
31
struct
is_shared_ptr
<std::shared_ptr<T> > :
public
std::true_type {};
32
}
// namespace type_traits
33
LIBCOPP_COPP_NAMESPACE_END
34
35
#if (defined(__cplusplus) && __cplusplus >= 201402L) || ((defined(_MSVC_LANG) && _MSVC_LANG >= 201402L))
36
# define COPP_IS_TIRVIALLY_COPYABLE(X) std::is_trivially_copyable<X>
37
# define COPP_IS_TIRVIALLY_COPYABLE_V(X) std::is_trivially_copyable<X>::value
38
#elif (defined(__cplusplus) && __cplusplus >= 201103L) || ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L))
39
# define COPP_IS_TIRVIALLY_COPYABLE(X) std::is_trivial<X>
40
# define COPP_IS_TIRVIALLY_COPYABLE_V(X) std::is_trivial<X>::value
41
#else
42
# define COPP_IS_TIRVIALLY_COPYABLE(X) std::is_pod<X>
43
# define COPP_IS_TIRVIALLY_COPYABLE_V(X) std::is_pod<X>::value
44
#endif
type_traits
Definition:
type_traits.h:18
stl_include_prefix.h
stl_include_suffix.h
type_traits::is_shared_ptr
Definition:
type_traits.h:29
Generated by
1.9.1