- Extracted traits from class to a detail namespace.

master
faluco 4 years ago committed by Francisco Paisana
parent 072e84cec8
commit 1253740da3

@ -31,17 +31,18 @@
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;
{
namespace detail {
/// Helper traits used by SFINAE expressions in constructors. /// Helper traits used by SFINAE expressions in constructors.
template <typename... Ts> template <typename... Ts>
struct make_void { struct make_void {
typedef void type; typedef void type;
}; };
template <typename... Ts> template <typename... Ts>
using void_t = typename make_void<Ts...>::type; using void_t = typename make_void<Ts...>::type;
@ -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())
{} {}

Loading…
Cancel
Save