Skip to content

Commit 6fbb04e

Browse files
committed
fix: utils helpers cause multiple definition error at compile time
1 parent f0d4920 commit 6fbb04e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/rpclite_utils.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace detail {
1313
/// --- deserialization helpers --- ///
1414
///////////////////////////////////////
1515

16-
bool unpackObject(MsgPack::Unpacker& unpacker);
16+
inline bool unpackObject(MsgPack::Unpacker& unpacker);
1717

18-
bool unpackArray(MsgPack::Unpacker& unpacker, size_t& size) {
18+
inline bool unpackArray(MsgPack::Unpacker& unpacker, size_t& size) {
1919
MsgPack::arr_size_t sz;
2020
unpacker.deserialize(sz);
2121

@@ -32,7 +32,7 @@ bool unpackArray(MsgPack::Unpacker& unpacker, size_t& size) {
3232

3333
}
3434

35-
bool unpackMap(MsgPack::Unpacker& unpacker, size_t& size) {
35+
inline bool unpackMap(MsgPack::Unpacker& unpacker, size_t& size) {
3636
MsgPack::map_size_t sz;
3737
unpacker.deserialize(sz);
3838

@@ -49,7 +49,7 @@ bool unpackMap(MsgPack::Unpacker& unpacker, size_t& size) {
4949

5050
}
5151

52-
bool unpackObject(MsgPack::Unpacker& unpacker){
52+
inline bool unpackObject(MsgPack::Unpacker& unpacker){
5353

5454
if (unpacker.isNil()){
5555
static MsgPack::object::nil_t nil;
@@ -100,7 +100,7 @@ bool unpackObject(MsgPack::Unpacker& unpacker){
100100
}
101101

102102
template<typename T>
103-
bool deserialize_single(MsgPack::Unpacker& unpacker, T& value) {
103+
inline bool deserialize_single(MsgPack::Unpacker& unpacker, T& value) {
104104
if (!unpacker.unpackable(value)) return false;
105105
unpacker.deserialize(value);
106106
return true;
@@ -112,26 +112,26 @@ bool deserialize_single(MsgPack::Unpacker& unpacker, T& value) {
112112
/////////////////////////////
113113

114114
template<std::size_t I = 0, typename... Ts>
115-
typename std::enable_if<I == sizeof...(Ts), bool>::type
115+
inline typename std::enable_if<I == sizeof...(Ts), bool>::type
116116
deserialize_tuple(MsgPack::Unpacker&, std::tuple<Ts...>&) {
117117
return true;
118118
}
119119

120120
template<std::size_t I = 0, typename... Ts>
121-
typename std::enable_if<I < sizeof...(Ts), bool>::type
121+
inline typename std::enable_if<I < sizeof...(Ts), bool>::type
122122
deserialize_tuple(MsgPack::Unpacker& unpacker, std::tuple<Ts...>& out) {
123123
if (!deserialize_single(unpacker, std::get<I>(out))) return false;
124124
return deserialize_tuple<I + 1>(unpacker, out);
125125
}
126126

127127
template<typename... Ts>
128-
bool deserialize_all(MsgPack::Unpacker& unpacker, std::tuple<Ts...>& values) {
128+
inline bool deserialize_all(MsgPack::Unpacker& unpacker, std::tuple<Ts...>& values) {
129129
return deserialize_tuple(unpacker, values);
130130
}
131131

132132
// Helper to invoke a function with a tuple of arguments
133133
template<typename F, typename Tuple, std::size_t... I>
134-
auto invoke_with_tuple(F&& f, Tuple&& t, arx::stdx::index_sequence<I...>)
134+
inline auto invoke_with_tuple(F&& f, Tuple&& t, arx::stdx::index_sequence<I...>)
135135
-> decltype(f(std::get<I>(std::forward<Tuple>(t))...)) {
136136
return f(std::get<I>(std::forward<Tuple>(t))...);
137137
}

0 commit comments

Comments
 (0)