NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/std/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 // IWYU pragma: private, include "opentelemetry/nostd/utility.h"
7 
8 #include <cstddef>
9 #include <utility>
10 
11 #include "opentelemetry/version.h"
12 
14 // Standard Type aliases in nostd namespace
15 namespace nostd
16 {
17 
18 //
19 // Backport of std::data
20 //
21 // See https://en.cppreference.com/w/cpp/iterator/data
22 //
23 template <class C>
24 auto data(C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
25 {
26  return c.data();
27 }
28 
29 template <class C>
30 auto data(const C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
31 {
32  return c.data();
33 }
34 
35 template <class T, std::size_t N>
36 T *data(T (&array)[N]) noexcept
37 {
38  return array;
39 }
40 
41 template <class E>
42 const E *data(std::initializer_list<E> list) noexcept
43 {
44  return list.begin();
45 }
46 
47 //
48 // Backport of std::size
49 //
50 // See https://en.cppreference.com/w/cpp/iterator/size
51 //
52 template <class C>
53 auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
54 {
55  return c.size();
56 }
57 
58 template <class T, std::size_t N>
59 std::size_t size(T (& /* array */)[N]) noexcept
60 {
61  return N;
62 }
63 
64 template <std::size_t N>
65 using make_index_sequence = std::make_index_sequence<N>;
66 
67 template <std::size_t... Ints>
68 using index_sequence = std::index_sequence<Ints...>;
69 
70 } // namespace nostd
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::index_sequence
integer_sequence< std::size_t, Is... > index_sequence
Back port of std::index_sequence.
Definition: includes/opentelemetry/nostd/utility.h:91
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
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::data
auto data(C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
Back port of std::data.
Definition: includes/opentelemetry/nostd/utility.h:31