Question

I haven't worked with C++ for some time, and I feel a little lost in the syntax. Could someone explain me the following lines from the boost::log library tutorial?

logging::core::get()->set_filter
(
    logging::trivial::severity >= logging::trivial::info
);

As far as I can see it's the function set_filter() call, but it takes a filter object:

BOOST_LOG_API void set_filter(filter const& filter)

and the expression:

logging::trivial::severity >= logging::trivial::info

returns bool? Is operator >= overloaded here? I've tried to figure it out through looking for definitions and macros but I can't see any operator overloading. It looks illogical to me. What does it do? How does it work?

Était-ce utile?

La solution

logging::trivial::severity >= logging::trivial::info returns a function object.

The function object does the comparison.

It is done by Boost.Phoenix library.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top