riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 129 forks source link

Problem of PendingPacket Class #268

Closed WhoLikeJkGirls closed 1 year ago

WhoLikeJkGirls commented 1 year ago

Hi @riebl

I'm working on this framework to building my custom routing simulation . However, When it comes to template class vanetza::geonet::PendingPacketb(in vanetza/geonet/pending_packet.hpp), I meet a trouble using the constructor:

template<typename PDU, typename... Args>
class PendingPacket
{
public:
    using Packet = std::tuple<std::unique_ptr<PDU>, std::unique_ptr<DownPacket>>;
    using Function = std::function<void(Packet&&, Args&&...)>;

    template<typename... OtherArgs, typename... T>
    PendingPacket(PendingPacket<PDU, OtherArgs...>&& other, T&&... ts) :
        m_packet(std::move(other).packet())
    {
        typename PendingPacket<PDU, OtherArgs...>::Function other_action = other.action();
        std::function<void(Packet&&)> bound = std::bind(other_action, std::placeholders::_1, std::forward<T>(ts)...);
        m_function = [bound](Packet&& packet, Args&&... args) {
            bound(std::move(packet), std::forward<Args>(args)...);
        };
    }

then I get the error that error: conversion from ‘std::_Bind_helper<false, std::function<void(Packet&&, const vanetza::MacAddress&, Extend::RouteCtrl*&&)>&, const std::_Placeholder<1>&, const vanetza::MacAddress&, Extend::RouteCtrl*&>::type’ {aka ‘std::_Bind<std::function<void(Packet &&, const vanetza::MacAddress&, Extend::RouteCtrl*&&)>(std::_Placeholder<1>, vanetza::MacAddress, Extend::RouteCtrl*)>’} to non-scalar type ‘std::function<void Packet &&)>’ requested I've get no idea to solve the problem. Can you give some advice sir?

Best regards.

riebl commented 1 year ago

Unfortunately, you have not shared the code invoking the PendingPacket constructor leading to this error. Without a little bit more information about your changes, I have hardly a chance to assist you.