3

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?

SathOkh
  • 826
  • 2
  • 12
  • 24

1 Answers1

3

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

The function object does the comparison.

It is done by Boost.Phoenix library.

wkordalski
  • 938
  • 8
  • 9
  • Thank you, for your answer. I've read a little about a Boost.Phoenix library and I think I'm getting the general idea of that code, although I'm far from understanding the way library works. – SathOkh Oct 28 '13 at 21:14