Skip to content

Commit ff33b88

Browse files
committed
Using stdlib index_sequence instead of arx
1 parent 1563227 commit ff33b88

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/rpclite_utils.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,15 @@ deserialize_tuple(MsgPack::Unpacker& unpacker, std::tuple<Ts...>& out) {
189189
return deserialize_tuple<I + 1>(unpacker, out);
190190
}
191191

192+
#ifdef ARDUINO_ARCH_ZEPHYR
193+
using std::index_sequence;
194+
#else
195+
using arx::stdx::index_sequence;
196+
#endif
197+
192198
// Helper to invoke a function with a tuple of arguments
193199
template<typename F, typename Tuple, std::size_t... I>
194-
inline auto invoke_with_tuple(F&& f, Tuple&& t, arx::stdx::index_sequence<I...>)
200+
inline auto invoke_with_tuple(F&& f, Tuple&& t, index_sequence<I...>)
195201
-> decltype(f(std::get<I>(std::forward<Tuple>(t))...)) {
196202
return f(std::get<I>(std::forward<Tuple>(t))...);
197203
}

src/wrapper.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class IFunctionWrapper {
3030
virtual bool operator()(MsgPack::Unpacker& unpacker, MsgPack::Packer& packer) = 0;
3131
};
3232

33+
#ifdef ARDUINO_ARCH_ZEPHYR
34+
using std::make_index_sequence;
35+
#else
36+
using arx::stdx::make_index_sequence;
37+
#endif
38+
3339
#ifdef ARDUINO_ARCH_ZEPHYR
3440
template<typename R, typename... Args>
3541
class RpcFunctionWrapper: public IFunctionWrapper {
@@ -100,7 +106,7 @@ class RpcFunctionWrapper<std::function<R(Args...)>>: public IFunctionWrapper {
100106
std::tuple<Args...> args;
101107
if (!deserialize_tuple(unpacker, args)) return false;
102108
MsgPack::object::nil_t nil;
103-
invoke_with_tuple(_func, args, arx::stdx::make_index_sequence<sizeof...(Args)>{});
109+
invoke_with_tuple(_func, args, make_index_sequence<sizeof...(Args)>{});
104110
packer.serialize(nil, nil);
105111
return true;
106112
}
@@ -112,7 +118,7 @@ class RpcFunctionWrapper<std::function<R(Args...)>>: public IFunctionWrapper {
112118
std::tuple<Args...> args;
113119
if (!deserialize_tuple(unpacker, args)) return false;
114120
MsgPack::object::nil_t nil;
115-
R out = invoke_with_tuple(_func, args, arx::stdx::make_index_sequence<sizeof...(Args)>{});
121+
R out = invoke_with_tuple(_func, args, make_index_sequence<sizeof...(Args)>{});
116122
packer.serialize(nil, out);
117123
return true;
118124
}

0 commit comments

Comments
 (0)