Skip to content

Commit

Permalink
fix c++14 warning (retry if supported)
Browse files Browse the repository at this point in the history
  • Loading branch information
hideakitai committed Apr 28, 2021
1 parent 47d4b72 commit d4215e3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions MsgPacketizer/Subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,24 +227,24 @@ namespace serial {
template <typename R, typename... Args>
inline void subscribe(const uint8_t index, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(index,
[&, cb {std::move(callback)}](const uint8_t* data, const size_t size) {
[&, callback](const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef();
unpacker->clear();
unpacker->feed(data, size);
std::tuple<std::remove_cvref_t<Args>...> t;
unpacker->to_tuple(t);
std::apply(cb, t);
std::apply(callback, t);
});
}

template <typename R, typename... Args>
inline void subscribe(std::function<R(Args...)>&& callback) {
Packetizer::subscribe(
[&, cb {std::move(callback)}](const uint8_t index, const uint8_t* data, const size_t size) {
[&, callback](const uint8_t index, const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef();
unpacker->clear();
unpacker->feed(data, size);
cb(index, *unpacker);
callback(index, *unpacker);
});
}

Expand Down Expand Up @@ -346,24 +346,24 @@ namespace serial {
template <typename R, typename... Args>
inline void subscribe(StreamType& stream, const uint8_t index, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream, index,
[&, cb {std::move(callback)}](const uint8_t* data, const size_t size) {
[&, callback](const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
std::tuple<std::remove_cvref_t<Args>...> t;
unpacker->to_tuple(t);
std::apply(cb, t);
std::apply(callback, t);
});
}

template <typename R, typename... Args>
inline void subscribe(StreamType& stream, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream,
[&, cb {std::move(callback)}](const uint8_t index, const uint8_t* data, const size_t size) {
[&, callback](const uint8_t index, const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
cb(index, *unpacker);
callback(index, *unpacker);
});
}

Expand Down Expand Up @@ -500,46 +500,46 @@ namespace serial {
template <typename R, typename... Args>
inline void subscribe(UDP& stream, const uint8_t index, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream, index,
[&, cb {std::move(callback)}](const uint8_t* data, const size_t size) {
[&, callback](const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
std::tuple<std::remove_cvref_t<Args>...> t;
unpacker->to_tuple(t);
std::apply(cb, t);
std::apply(callback, t);
});
}
template <typename R, typename... Args>
inline void subscribe(Client& stream, const uint8_t index, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream, index,
[&, cb {std::move(callback)}](const uint8_t* data, const size_t size) {
[&, callback](const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
std::tuple<std::remove_cvref_t<Args>...> t;
unpacker->to_tuple(t);
std::apply(cb, t);
std::apply(callback, t);
});
}

template <typename R, typename... Args>
inline void subscribe(UDP& stream, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream,
[&, cb {std::move(callback)}](const uint8_t index, const uint8_t* data, const size_t size) {
[&, callback](const uint8_t index, const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
cb(index, *unpacker);
callback(index, *unpacker);
});
}
template <typename R, typename... Args>
inline void subscribe(Client& stream, std::function<R(Args...)>&& callback) {
Packetizer::subscribe(stream,
[&, cb {std::move(callback)}](const uint8_t index, const uint8_t* data, const size_t size) {
[&, callback](const uint8_t index, const uint8_t* data, const size_t size) {
auto unpacker = UnpackerManager::getInstance().getUnpackerRef(stream);
unpacker->clear();
unpacker->feed(data, size);
cb(index, *unpacker);
callback(index, *unpacker);
});
}

Expand Down

0 comments on commit d4215e3

Please sign in to comment.