|
|
@ -31,37 +31,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace srslte {
|
|
|
|
namespace srslte {
|
|
|
|
|
|
|
|
|
|
|
|
/// The class template span describes an object that can refer to a contiguous sequence of objects with the first
|
|
|
|
|
|
|
|
/// element of the sequence at position zero.
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
template <typename T>
|
|
|
|
class span
|
|
|
|
class span;
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Helper traits used by SFINAE expressions in constructors.
|
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
/// Helper traits used by SFINAE expressions in constructors.
|
|
|
|
struct make_void {
|
|
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
|
|
|
struct make_void {
|
|
|
|
typedef void type;
|
|
|
|
typedef void type;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
template <typename... Ts>
|
|
|
|
|
|
|
|
using void_t = typename make_void<Ts...>::type;
|
|
|
|
template <typename... Ts>
|
|
|
|
|
|
|
|
using void_t = typename make_void<Ts...>::type;
|
|
|
|
template <typename U>
|
|
|
|
|
|
|
|
struct is_span : std::false_type {};
|
|
|
|
template <typename U>
|
|
|
|
template <typename U>
|
|
|
|
struct is_span : std::false_type {};
|
|
|
|
struct is_span<span<U> > : std::true_type {};
|
|
|
|
template <typename U>
|
|
|
|
|
|
|
|
struct is_span<span<U> > : std::true_type {};
|
|
|
|
template <typename U>
|
|
|
|
|
|
|
|
struct is_std_array : std::false_type {};
|
|
|
|
template <typename U>
|
|
|
|
template <typename U, std::size_t N>
|
|
|
|
struct is_std_array : std::false_type {};
|
|
|
|
struct is_std_array<std::array<U, N> > : std::true_type {};
|
|
|
|
template <typename U, std::size_t N>
|
|
|
|
|
|
|
|
struct is_std_array<std::array<U, N> > : std::true_type {};
|
|
|
|
template <typename U>
|
|
|
|
|
|
|
|
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<U>::type>::type;
|
|
|
|
template <typename U>
|
|
|
|
|
|
|
|
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<U>::type>::type;
|
|
|
|
template <class Container, class U, class = void>
|
|
|
|
|
|
|
|
struct is_container_compatible : public std::false_type {};
|
|
|
|
template <class Container, class U, class = void>
|
|
|
|
template <class Container, class U>
|
|
|
|
struct is_container_compatible : public std::false_type {};
|
|
|
|
struct is_container_compatible<
|
|
|
|
template <class Container, class U>
|
|
|
|
|
|
|
|
struct is_container_compatible<
|
|
|
|
Container,
|
|
|
|
Container,
|
|
|
|
U,
|
|
|
|
U,
|
|
|
|
void_t<
|
|
|
|
void_t<
|
|
|
@ -80,6 +81,13 @@ class span
|
|
|
|
U (*)[]>::value,
|
|
|
|
U (*)[]>::value,
|
|
|
|
int>::type> > : public std::true_type {};
|
|
|
|
int>::type> > : public std::true_type {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// The class template span describes an object that can refer to a contiguous sequence of objects with the first
|
|
|
|
|
|
|
|
/// element of the sequence at position zero.
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
|
|
|
class span
|
|
|
|
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/// Member types.
|
|
|
|
/// Member types.
|
|
|
|
using element_type = T;
|
|
|
|
using element_type = T;
|
|
|
@ -123,13 +131,14 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
template <typename Container,
|
|
|
|
template <typename Container,
|
|
|
|
typename std::enable_if<is_container_compatible<Container, element_type>::value, int>::type = 0>
|
|
|
|
typename std::enable_if<detail::is_container_compatible<Container, element_type>::value, int>::type = 0>
|
|
|
|
constexpr span(Container& c) noexcept : ptr(c.data()), len(c.size())
|
|
|
|
constexpr span(Container& c) noexcept : ptr(c.data()), len(c.size())
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
template <typename Container,
|
|
|
|
template <
|
|
|
|
typename std::enable_if<is_container_compatible<const Container, element_type>::value, int>::type = 0>
|
|
|
|
typename Container,
|
|
|
|
|
|
|
|
typename std::enable_if<detail::is_container_compatible<const Container, element_type>::value, int>::type = 0>
|
|
|
|
constexpr span(const Container& c) noexcept : ptr(c.data()), len(c.size())
|
|
|
|
constexpr span(const Container& c) noexcept : ptr(c.data()), len(c.size())
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|