NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/includes/opentelemetry/nostd/detail/trait.h
Go to the documentation of this file.
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include <type_traits>
7 
8 #include "opentelemetry/nostd/type_traits.h"
9 #include "opentelemetry/version.h"
10 
12 namespace nostd
13 {
14 namespace detail
15 {
16 enum class Trait
17 {
19  Available,
21 };
22 
23 template <typename T,
24  template <typename>
25  class IsTriviallyAvailable,
26  template <typename>
27  class IsAvailable>
28 inline constexpr Trait trait()
29 {
30  return IsTriviallyAvailable<T>::value ? Trait::TriviallyAvailable
31  : IsAvailable<T>::value ? Trait::Available
33 }
34 
35 inline constexpr Trait common_trait_impl(Trait result)
36 {
37  return result;
38 }
39 
40 template <typename... Traits>
41 inline constexpr Trait common_trait_impl(Trait result, Trait t, Traits... ts)
42 {
43  return static_cast<int>(t) > static_cast<int>(result) ? common_trait_impl(t, ts...)
44  : common_trait_impl(result, ts...);
45 }
46 
47 template <typename... Traits>
48 inline constexpr Trait common_trait(Traits... ts)
49 {
51 }
52 
53 template <typename... Ts>
54 struct traits
55 {
56  static constexpr Trait copy_constructible_trait =
57  common_trait(trait<Ts, is_trivially_copy_constructible, std::is_copy_constructible>()...);
58 
59  static constexpr Trait move_constructible_trait =
60  common_trait(trait<Ts, is_trivially_move_constructible, std::is_move_constructible>()...);
61 
62  static constexpr Trait copy_assignable_trait =
64  trait<Ts, is_trivially_copy_assignable, std::is_copy_assignable>()...);
65 
66  static constexpr Trait move_assignable_trait =
68  trait<Ts, is_trivially_move_assignable, std::is_move_assignable>()...);
69 
70  static constexpr Trait destructible_trait =
71  common_trait(trait<Ts, std::is_trivially_destructible, std::is_destructible>()...);
72 };
73 } // namespace detail
74 } // namespace nostd
nostd::detail::common_trait_impl
constexpr Trait common_trait_impl(Trait result)
Definition: includes/opentelemetry/nostd/detail/trait.h:35
nostd::detail::common_trait
constexpr Trait common_trait(Traits... ts)
Definition: includes/opentelemetry/nostd/detail/trait.h:48
nostd
Definition: includes/opentelemetry/nostd/function_ref.h:14
nostd::detail::Trait::Available
@ Available
nostd::detail::trait
constexpr Trait trait()
Definition: includes/opentelemetry/nostd/detail/trait.h:28
nostd::detail::traits::move_assignable_trait
static constexpr Trait move_assignable_trait
Definition: includes/opentelemetry/nostd/detail/trait.h:66
nostd::detail::traits::destructible_trait
static constexpr Trait destructible_trait
Definition: includes/opentelemetry/nostd/detail/trait.h:70
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
nostd::detail::Trait::TriviallyAvailable
@ TriviallyAvailable
nostd::detail::Trait
Trait
Definition: includes/opentelemetry/nostd/detail/trait.h:16
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
nostd::detail::traits::copy_assignable_trait
static constexpr Trait copy_assignable_trait
Definition: includes/opentelemetry/nostd/detail/trait.h:62
nostd::detail::traits::move_constructible_trait
static constexpr Trait move_constructible_trait
Definition: includes/opentelemetry/nostd/detail/trait.h:59
nostd::detail::traits::copy_constructible_trait
static constexpr Trait copy_constructible_trait
Definition: includes/opentelemetry/nostd/detail/trait.h:56
nostd::detail::Trait::Unavailable
@ Unavailable
nostd::Traits
std::char_traits< char > Traits
Definition: includes/opentelemetry/nostd/string_view.h:29