Commit 48e941b1 authored by Dominik Charousset's avatar Dominik Charousset

Fix build on debian-8

parent ba74bb57
...@@ -90,7 +90,7 @@ void caf_main(actor_system& system, const config&) { ...@@ -90,7 +90,7 @@ void caf_main(actor_system& system, const config&) {
f1.b.resize(1); f1.b.resize(1);
f1.b.back().push_back(42); f1.b.back().push_back(42);
// I/O buffer // I/O buffer
vector<char> buf; binary_serializer::container_type buf;
// write f1 to buffer // write f1 to buffer
binary_serializer bs{system, buf}; binary_serializer bs{system, buf};
auto e = bs(f1); auto e = bs(f1);
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <cstddef> #include <cstddef>
#include <string> #include <string>
#include <string_view>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
...@@ -28,6 +27,7 @@ ...@@ -28,6 +27,7 @@
#include "caf/fwd.hpp" #include "caf/fwd.hpp"
#include "caf/sec.hpp" #include "caf/sec.hpp"
#include "caf/span.hpp" #include "caf/span.hpp"
#include "caf/string_view.hpp"
#include "caf/write_inspector.hpp" #include "caf/write_inspector.hpp"
namespace caf { namespace caf {
...@@ -55,12 +55,14 @@ public: ...@@ -55,12 +55,14 @@ public:
binary_deserializer(execution_unit* ctx, const void* buf, binary_deserializer(execution_unit* ctx, const void* buf,
size_t size) noexcept size_t size) noexcept
: binary_deserializer(ctx, span{reinterpret_cast<const byte*>(buf), size}) { : binary_deserializer(ctx, make_span(reinterpret_cast<const byte*>(buf),
size)) {
// nop // nop
} }
binary_deserializer(actor_system& sys, const void* buf, size_t size) noexcept binary_deserializer(actor_system& sys, const void* buf, size_t size) noexcept
: binary_deserializer(sys, span{reinterpret_cast<const byte*>(buf), size}) { : binary_deserializer(sys, make_span(reinterpret_cast<const byte*>(buf),
size)) {
// nop // nop
} }
......
...@@ -124,7 +124,8 @@ public: ...@@ -124,7 +124,8 @@ public:
void apply(span<const byte> x); void apply(span<const byte> x);
template <class T> template <class T>
std::enable_if_t<std::is_integral_v<T> && std::is_signed_v<T>> apply(T x) { std::enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value>
apply(T x) {
return apply(static_cast<std::make_unsigned_t<T>>(x)); return apply(static_cast<std::make_unsigned_t<T>>(x));
} }
......
...@@ -729,7 +729,7 @@ template <class T> ...@@ -729,7 +729,7 @@ template <class T>
struct is_stl_tuple_type { struct is_stl_tuple_type {
template <class U> template <class U>
static auto sfinae(U*) static auto sfinae(U*)
-> decltype(std::bool_constant<std::tuple_size<U>::value >= 0>{}); -> decltype(std::integral_constant<bool, std::tuple_size<U>::value >= 0>{});
template <class U> template <class U>
static auto sfinae(...) -> std::false_type; static auto sfinae(...) -> std::false_type;
......
...@@ -77,21 +77,21 @@ public: ...@@ -77,21 +77,21 @@ public:
} else { } else {
CAF_READ_INSPECTOR_TRY(dref.apply(x)) CAF_READ_INSPECTOR_TRY(dref.apply(x))
} }
} else if constexpr (std::is_integral_v<type>) { } else if constexpr (std::is_integral<type>::value) {
using squashed_type = detail::squashed_int_t<type>; using squashed_type = detail::squashed_int_t<type>;
CAF_READ_INSPECTOR_TRY(dref.apply(static_cast<squashed_type>(x))) CAF_READ_INSPECTOR_TRY(dref.apply(static_cast<squashed_type>(x)))
} else if constexpr (std::is_array<type>::value) { } else if constexpr (std::is_array<type>::value) {
CAF_READ_INSPECTOR_TRY(apply_array(dref, x)) CAF_READ_INSPECTOR_TRY(apply_array(dref, x))
} else if constexpr (detail::is_stl_tuple_type_v<type>) { } else if constexpr (detail::is_stl_tuple_type<type>::value) {
std::make_index_sequence<std::tuple_size_v<type>> seq; std::make_index_sequence<std::tuple_size<type>::value> seq;
CAF_READ_INSPECTOR_TRY(apply_tuple(dref, x, seq)) CAF_READ_INSPECTOR_TRY(apply_tuple(dref, x, seq))
} else if constexpr (detail::is_map_like_v<type>) { } else if constexpr (detail::is_map_like<type>::value) {
CAF_READ_INSPECTOR_TRY(dref.begin_sequence(x.size())) CAF_READ_INSPECTOR_TRY(dref.begin_sequence(x.size()))
for (const auto& [key, value] : x) { for (const auto& kvp : x) {
CAF_READ_INSPECTOR_TRY(dref(key, value)) CAF_READ_INSPECTOR_TRY(dref(kvp.first, kvp.second))
} }
CAF_READ_INSPECTOR_TRY(dref.end_sequence()) CAF_READ_INSPECTOR_TRY(dref.end_sequence())
} else if constexpr (detail::is_list_like_v<type>) { } else if constexpr (detail::is_list_like<type>::value) {
CAF_READ_INSPECTOR_TRY(dref.begin_sequence(x.size())) CAF_READ_INSPECTOR_TRY(dref.begin_sequence(x.size()))
for (const auto& value : x) { for (const auto& value : x) {
CAF_READ_INSPECTOR_TRY(dref(value)) CAF_READ_INSPECTOR_TRY(dref(value))
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <string_view> #include <string>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "caf/read_inspector.hpp" #include "caf/read_inspector.hpp"
#include "caf/sec.hpp" #include "caf/sec.hpp"
#include "caf/span.hpp" #include "caf/span.hpp"
#include "caf/string_view.hpp"
namespace caf { namespace caf {
...@@ -125,10 +126,10 @@ public: ...@@ -125,10 +126,10 @@ public:
virtual result_type apply(string_view x) = 0; virtual result_type apply(string_view x) = 0;
/// @copydoc apply /// @copydoc apply
virtual result_type apply(std::u16string_view x) = 0; virtual result_type apply(const std::u16string& x) = 0;
/// @copydoc apply /// @copydoc apply
virtual result_type apply(std::u32string_view x) = 0; virtual result_type apply(const std::u32string& x) = 0;
template <class Enum, class = std::enable_if_t<std::is_enum<Enum>::value>> template <class Enum, class = std::enable_if_t<std::is_enum<Enum>::value>>
result_type apply(Enum x) { result_type apply(Enum x) {
......
...@@ -69,13 +69,13 @@ public: ...@@ -69,13 +69,13 @@ public:
// skip element // skip element
} else if constexpr (detail::can_apply_v<Subtype, decltype(x)>) { } else if constexpr (detail::can_apply_v<Subtype, decltype(x)>) {
CAF_WRITE_INSPECTOR_TRY(dref.apply(x)) CAF_WRITE_INSPECTOR_TRY(dref.apply(x))
} else if constexpr (std::is_integral_v<type>) { } else if constexpr (std::is_integral<type>::value) {
using squashed_type = detail::squashed_int_t<type>; using squashed_type = detail::squashed_int_t<type>;
CAF_WRITE_INSPECTOR_TRY(dref.apply(reinterpret_cast<squashed_type&>(x))) CAF_WRITE_INSPECTOR_TRY(dref.apply(reinterpret_cast<squashed_type&>(x)))
} else if constexpr (std::is_array<type>::value) { } else if constexpr (std::is_array<type>::value) {
CAF_WRITE_INSPECTOR_TRY(apply_array(dref, x)) CAF_WRITE_INSPECTOR_TRY(apply_array(dref, x))
} else if constexpr (detail::is_stl_tuple_type_v<type>) { } else if constexpr (detail::is_stl_tuple_type_v<type>) {
std::make_index_sequence<std::tuple_size_v<type>> seq; std::make_index_sequence<std::tuple_size<type>::value> seq;
CAF_WRITE_INSPECTOR_TRY(apply_tuple(dref, x, seq)) CAF_WRITE_INSPECTOR_TRY(apply_tuple(dref, x, seq))
} else if constexpr (detail::is_map_like_v<type>) { } else if constexpr (detail::is_map_like_v<type>) {
x.clear(); x.clear();
...@@ -99,8 +99,8 @@ public: ...@@ -99,8 +99,8 @@ public:
} }
CAF_WRITE_INSPECTOR_TRY(dref.end_sequence()) CAF_WRITE_INSPECTOR_TRY(dref.end_sequence())
} else { } else {
static_assert(std::is_lvalue_reference_v<decltype(x)> // static_assert(std::is_lvalue_reference<decltype(x)>::value //
&& !std::is_const_v<decltype(x)>); && !std::is_const<decltype(x)>::value);
static_assert(detail::is_inspectable<Subtype, type>::value); static_assert(detail::is_inspectable<Subtype, type>::value);
using caf::detail::inspect; using caf::detail::inspect;
CAF_WRITE_INSPECTOR_TRY(inspect(dref, x)); CAF_WRITE_INSPECTOR_TRY(inspect(dref, x));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment