|
|
|
@ -31,17 +31,18 @@
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
class span
|
|
|
|
|
{
|
|
|
|
|
class span;
|
|
|
|
|
|
|
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
|
|
/// Helper traits used by SFINAE expressions in constructors.
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
struct make_void {
|
|
|
|
|
typedef void type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
using void_t = typename make_void<Ts...>::type;
|
|
|
|
|
|
|
|
|
@ -80,6 +81,13 @@ class span
|
|
|
|
|
U (*)[]>::value,
|
|
|
|
|
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:
|
|
|
|
|
/// Member types.
|
|
|
|
|
using element_type = T;
|
|
|
|
@ -123,13 +131,14 @@ public:
|
|
|
|
|
|
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
|
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())
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
/// Constructs a span that is a view over the container c.
|
|
|
|
|
template <typename Container,
|
|
|
|
|
typename std::enable_if<is_container_compatible<const Container, element_type>::value, int>::type = 0>
|
|
|
|
|
template <
|
|
|
|
|
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())
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|