Revert "libcamera: span: Provide and use helper variable templates for type traits"

Some applications may not be compliant with C++17 (Chromium, as an
example). Keep the C++17 features for libcamera internals, and C++14
compliance for public API.

This reverts commit 8e42c2feb7.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jean-Michel Hautbois 2021-01-26 14:04:14 +01:00 committed by Laurent Pinchart
parent 3809fd7746
commit 33bfe7b7ef
2 changed files with 14 additions and 20 deletions

View file

@ -96,7 +96,7 @@ public:
ControlValue(); ControlValue();
#ifndef __DOXYGEN__ #ifndef __DOXYGEN__
template<typename T, typename std::enable_if_t<!details::is_span_v<T> && template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
details::control_type<T>::value && details::control_type<T>::value &&
!std::is_same_v<std::string, std::remove_cv_t<T>>, !std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
@ -107,7 +107,7 @@ public:
&value, 1, sizeof(T)); &value, 1, sizeof(T));
} }
template<typename T, typename std::enable_if_t<details::is_span_v<T> || template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
std::is_same_v<std::string, std::remove_cv_t<T>>, std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
#else #else
@ -141,7 +141,7 @@ public:
} }
#ifndef __DOXYGEN__ #ifndef __DOXYGEN__
template<typename T, typename std::enable_if_t<!details::is_span_v<T> && template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
!std::is_same_v<std::string, std::remove_cv_t<T>>, !std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
T get() const T get() const
@ -152,7 +152,7 @@ public:
return *reinterpret_cast<const T *>(data().data()); return *reinterpret_cast<const T *>(data().data());
} }
template<typename T, typename std::enable_if_t<details::is_span_v<T> || template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
std::is_same_v<std::string, std::remove_cv_t<T>>, std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
#else #else
@ -169,7 +169,7 @@ public:
} }
#ifndef __DOXYGEN__ #ifndef __DOXYGEN__
template<typename T, typename std::enable_if_t<!details::is_span_v<T> && template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
!std::is_same_v<std::string, std::remove_cv_t<T>>, !std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
void set(const T &value) void set(const T &value)
@ -178,7 +178,7 @@ public:
reinterpret_cast<const void *>(&value), 1, sizeof(T)); reinterpret_cast<const void *>(&value), 1, sizeof(T));
} }
template<typename T, typename std::enable_if_t<details::is_span_v<T> || template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
std::is_same_v<std::string, std::remove_cv_t<T>>, std::is_same_v<std::string, std::remove_cv_t<T>>,
std::nullptr_t> = nullptr> std::nullptr_t> = nullptr>
#else #else

View file

@ -31,9 +31,6 @@ template<typename U, std::size_t N>
struct is_array<std::array<U, N>> : public std::true_type { struct is_array<std::array<U, N>> : public std::true_type {
}; };
template<typename T>
inline constexpr bool is_array_v = is_array<T>::value;
template<typename U> template<typename U>
struct is_span : public std::false_type { struct is_span : public std::false_type {
}; };
@ -42,9 +39,6 @@ template<typename U, std::size_t Extent>
struct is_span<Span<U, Extent>> : public std::true_type { struct is_span<Span<U, Extent>> : public std::true_type {
}; };
template<typename T>
inline constexpr bool is_span_v = is_span<T>::value;
} /* namespace details */ } /* namespace details */
namespace utils { namespace utils {
@ -161,8 +155,8 @@ public:
template<class Container> template<class Container>
explicit constexpr Span(Container &cont, explicit constexpr Span(Container &cont,
std::enable_if_t<!details::is_span_v<Container> && std::enable_if_t<!details::is_span<Container>::value &&
!details::is_array_v<Container> && !details::is_array<Container>::value &&
!std::is_array_v<Container> && !std::is_array_v<Container> &&
std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
element_type (*)[]>, element_type (*)[]>,
@ -173,8 +167,8 @@ public:
template<class Container> template<class Container>
explicit constexpr Span(const Container &cont, explicit constexpr Span(const Container &cont,
std::enable_if_t<!details::is_span_v<Container> && std::enable_if_t<!details::is_span<Container>::value &&
!details::is_array_v<Container> && !details::is_array<Container>::value &&
!std::is_array_v<Container> && !std::is_array_v<Container> &&
std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
element_type (*)[]>, element_type (*)[]>,
@ -323,8 +317,8 @@ public:
template<class Container> template<class Container>
constexpr Span(Container &cont, constexpr Span(Container &cont,
std::enable_if_t<!details::is_span_v<Container> && std::enable_if_t<!details::is_span<Container>::value &&
!details::is_array_v<Container> && !details::is_array<Container>::value &&
!std::is_array_v<Container> && !std::is_array_v<Container> &&
std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
element_type (*)[]>, element_type (*)[]>,
@ -335,8 +329,8 @@ public:
template<class Container> template<class Container>
constexpr Span(const Container &cont, constexpr Span(const Container &cont,
std::enable_if_t<!details::is_span_v<Container> && std::enable_if_t<!details::is_span<Container>::value &&
!details::is_array_v<Container> && !details::is_array<Container>::value &&
!std::is_array_v<Container> && !std::is_array_v<Container> &&
std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], std::is_convertible_v<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],
element_type (*)[]>, element_type (*)[]>,