lundi 29 mai 2017

How to rewrite function, without using lambda expression?

I have one library, which is written with c++11 standard(at least) and my compiler which is c++0x. Library contains some functions, that i have to revert to c++0x. Since i have no experience with lambda expressions, i am stuck at rewriting the following function:

void EventTrace::connect(Connector& connector)
{
    Connector::EventSignal& s = connector.getEventSignal();
    connection_ = s.connect(
        [this](int e)
        {
            if (decoders_.empty())
            {
                poco_information_f1(LOGGER(), "Event %d", e);
            }
            for (Decoder decoder : decoders_)
            {
                try
                {
                    decoder(e);
                }
                catch (Exception& exception)
                {
                    poco_warning_f1(LOGGER(), "EventTrace Decoder error %s", exception.displayText());
                }
            }
        }
    );
}

Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire