OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ssize.hpp
1
#pragma once
2
3
#if __has_include(<version>)
4
#include <version>
5
// MacOSX11.3 SDK provides ssize but does not define it...
6
#if __cpp_lib_ssize >= 201902L \
7
|| (__MAC_OS_X_VERSION_MIN_REQUIRED >= 114000 && _LIBCPP_STD_VER > 17) \
8
|| defined(__EMSCRIPTEN__)
9
#include <iterator>
10
#define OSSIA_HAS_STD_SSIZE 1
11
#endif
12
#endif
13
14
#if !defined(OSSIA_HAS_STD_SSIZE)
15
#include <type_traits>
16
namespace
std
17
{
18
template
<
class
T>
19
static
constexpr
auto
ssize(
const
T& t)
noexcept
20
{
21
return
static_cast<
common_type_t<ptrdiff_t, make_signed_t<decltype(t.size())
>
>>(
22
t.size());
23
}
24
25
template
<
class
T, ptrdiff_t S>
26
static
constexpr
ptrdiff_t ssize(
const
T (&)[S])
noexcept
27
{
28
return
S;
29
}
30
}
31
#endif
src
ossia
detail
ssize.hpp
Generated on Mon Mar 31 2025 23:58:28 for OSSIA by
1.9.8