egor
egor

Reputation: 13

boost::log 1.66.0. Argument for set_filter from boost's tutorial is wrong

I'm going thru boost::log library tutorial using Boost 1.66.0 and VS 2017. Get the problem in the very beginning:

void init()  
{ 
  logging::core::get()->set_filter
  (
    logging::trivial::severity >= logging::trivial::info
  );
}

Error: No operator ">=" matches these operands ... It looks legitimate - First operand is a structure with no any comparison operators defined(including public base class. Did I miss some free functions?). Second operand is enum.
My question is how it is worked before?

Upvotes: 1

Views: 164

Answers (1)

Andrey Semashev
Andrey Semashev

Reputation: 10614

The example code is not wrong and you can test that it compiles and runs, see libs/log/example/doc/tutorial_trivial_flt.cpp for the full code.

The first argument in the filter expression is a keyword and also a Boost.Phoenix terminal. It makes the filter expression build a Boost.Phoenix function object instead of evaluating the comparison immediately. The comparison operator is thus taken from Boost.Phoenix (boost/phoenix/operator/comparison.hpp, which is included through boost/phoenix/operator.hpp by boost/log/expressions.hpp).

Upvotes: 1

Related Questions