fix: conditional use and tests of span (#411)

This commit is contained in:
Stanislav Angelovič
2024-04-24 20:20:29 +02:00
parent 4c35e98668
commit abc4d755f7
4 changed files with 19 additions and 15 deletions
+8 -6
View File
@@ -36,8 +36,10 @@
#include <cstdint>
#include <functional>
#include <map>
#if __cplusplus >= 202002L
#include <span>
#ifdef __has_include
# if __has_include(<span>)
# include <span>
# endif
#endif
#include <string>
#include <sys/types.h>
@@ -104,7 +106,7 @@ namespace sdbus {
Message& operator<<(const std::vector<_Element, _Allocator>& items);
template <typename _Element, std::size_t _Size>
Message& operator<<(const std::array<_Element, _Size>& items);
#if __cplusplus >= 202002L
#ifdef __cpp_lib_span
template <typename _Element, std::size_t _Extent>
Message& operator<<(const std::span<_Element, _Extent>& items);
#endif
@@ -140,7 +142,7 @@ namespace sdbus {
Message& operator>>(std::vector<_Element, _Allocator>& items);
template <typename _Element, std::size_t _Size>
Message& operator>>(std::array<_Element, _Size>& items);
#if __cplusplus >= 202002L
#ifdef __cpp_lib_span
template <typename _Element, std::size_t _Extent>
Message& operator>>(std::span<_Element, _Extent>& items);
#endif
@@ -339,7 +341,7 @@ namespace sdbus {
return *this;
}
#if __cplusplus >= 202002L
#ifdef __cpp_lib_span
template <typename _Element, std::size_t _Extent>
inline Message& Message::operator<<(const std::span<_Element, _Extent>& items)
{
@@ -498,7 +500,7 @@ namespace sdbus {
return *this;
}
#if __cplusplus >= 202002L
#ifdef __cpp_lib_span
template <typename _Element, std::size_t _Extent>
inline Message& Message::operator>>(std::span<_Element, _Extent>& items)
{
+5 -3
View File
@@ -35,8 +35,10 @@
#include <map>
#include <memory>
#include <optional>
#if __cplusplus >= 202002L
#include <span>
#ifdef __has_include
# if __has_include(<span>)
# include <span>
# endif
#endif
#include <string>
#include <tuple>
@@ -399,7 +401,7 @@ namespace sdbus {
}
};
#if __cplusplus >= 202002L
#ifdef __cpp_lib_span
template <typename _Element, std::size_t _Extent>
struct signature_of<std::span<_Element, _Extent>>
{