NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/nostd/utility.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 #if defined(OPENTELEMETRY_STL_VERSION)
7 # if OPENTELEMETRY_STL_VERSION >= 2014
8 # include "opentelemetry/std/utility.h"
9 # define OPENTELEMETRY_HAVE_STD_UTILITY
10 # endif
11 #endif
12 
13 #if !defined(OPENTELEMETRY_HAVE_STD_UTILITY)
14 # include <cstddef>
15 # include <initializer_list>
16 # include <type_traits>
17 
18 # include "opentelemetry/nostd/detail/decay.h" // IWYU pragma: export
19 # include "opentelemetry/nostd/detail/invoke.h" // IWYU pragma: export
20 # include "opentelemetry/version.h"
21 
23 namespace nostd
24 {
30 template <class C>
31 auto data(C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
32 {
33  return c.data();
34 }
35 
36 template <class C>
37 auto data(const C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
38 {
39  return c.data();
40 }
41 
42 template <class T, size_t N>
43 T *data(T (&array)[N]) noexcept
44 {
45  return array;
46 }
47 
48 template <class E>
49 const E *data(std::initializer_list<E> list) noexcept
50 {
51  return list.begin();
52 }
53 
59 template <class C>
60 auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
61 {
62  return c.size();
63 }
64 
65 template <class T, size_t N>
66 size_t size(T (& /* array */)[N]) noexcept
67 {
68  return N;
69 }
70 
74 template <bool B>
75 using bool_constant = std::integral_constant<bool, B>;
76 
80 template <typename T, T... Is>
82 {
83  using value_type = T;
84  static constexpr std::size_t size() noexcept { return sizeof...(Is); }
85 };
86 
90 template <std::size_t... Is>
91 using index_sequence = integer_sequence<std::size_t, Is...>;
92 
96 namespace detail
97 {
98 template <class, size_t>
100 {};
101 
102 template <size_t... Indexes, size_t I>
104 {
105  using type = index_sequence<Indexes..., I>;
106 };
107 
108 template <class T, size_t I>
110 
111 template <size_t N>
113 {
115 };
116 
117 template <>
119 {
121 };
122 } // namespace detail
123 
124 template <size_t N>
126 
130 template <class... Ts>
132 
137 {
138  explicit in_place_t() = default;
139 };
140 
144 template <std::size_t I>
146 {
147  explicit in_place_index_t() = default;
148 };
149 
153 template <typename T>
155 {
156  explicit in_place_type_t() = default;
157 };
158 } // namespace nostd
160 #endif /* OPENTELEMETRY_HAVE_STD_UTILITY */
nostd::make_index_sequence
typename detail::make_index_sequence_impl< N >::type make_index_sequence
Definition: includes/opentelemetry/nostd/utility.h:125
nostd
Definition: includes/opentelemetry/nostd/function_ref.h:14
nostd::in_place_type_t::in_place_type_t
in_place_type_t()=default
nostd::integer_sequence::value_type
T value_type
Definition: includes/opentelemetry/nostd/utility.h:83
nostd::in_place_index_t::in_place_index_t
in_place_index_t()=default
nostd::detail::make_index_sequence_impl
Definition: includes/opentelemetry/nostd/utility.h:112
nostd::detail::index_sequence_push_back_t
typename index_sequence_push_back< T, I >::type index_sequence_push_back_t
Definition: includes/opentelemetry/nostd/utility.h:109
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
nostd::detail::index_sequence_push_back
Definition: includes/opentelemetry/nostd/utility.h:99
nostd::in_place_t::in_place_t
in_place_t()=default
nostd::in_place_type_t
Back port of std::in_place_type_t.
Definition: includes/opentelemetry/nostd/utility.h:154
nostd::in_place_index_t
Back port of std::in_place_index_t.
Definition: includes/opentelemetry/nostd/utility.h:145
nostd::in_place_t
Back port of std::in_place_t.
Definition: includes/opentelemetry/nostd/utility.h:136
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
nostd::detail::make_index_sequence_impl::type
index_sequence_push_back_t< typename make_index_sequence_impl< N - 1 >::type, N - 1 > type
Definition: includes/opentelemetry/nostd/utility.h:114
nostd::size
auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
Back port of std::size.
Definition: includes/opentelemetry/nostd/utility.h:60
nostd::integer_sequence::size
static constexpr std::size_t size() noexcept
Definition: includes/opentelemetry/nostd/utility.h:84
nostd::index_sequence_for
make_index_sequence< sizeof...(Ts)> index_sequence_for
Back port of std::index_sequence_for.
Definition: includes/opentelemetry/nostd/utility.h:131
nostd::bool_constant
std::integral_constant< bool, B > bool_constant
Back port of std::bool_constant.
Definition: includes/opentelemetry/nostd/utility.h:75
nostd::integer_sequence
Back port of std::integer_sequence.
Definition: includes/opentelemetry/nostd/utility.h:81
nostd::data
auto data(C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
Back port of std::data.
Definition: includes/opentelemetry/nostd/utility.h:31