1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-13 16:56:52 +00:00

Use lambda instead of boost::build when genenic lambdas are available in the compiler

This commit is contained in:
Carles Fernandez 2020-04-25 21:41:04 +02:00
parent a49e4d48f6
commit fdb0f35116
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 19 additions and 2 deletions

View File

@ -76,6 +76,14 @@ target_compile_definitions(front-end-cal
PUBLIC -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}"
)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(front-end-cal
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(front-end-cal

View File

@ -38,7 +38,6 @@
#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
#include "gps_utc_model.h"
#include <boost/any.hpp> // for bad_any_cast
#include <boost/bind.hpp>
#include <boost/exception/exception.hpp>
#include <boost/lexical_cast.hpp>
#include <gflags/gflags.h>
@ -70,6 +69,11 @@
#include <utility>
#include <vector>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
@ -142,7 +146,12 @@ void FrontEndCal_msg_rx::msg_handler_events(const pmt::pmt_t& msg)
FrontEndCal_msg_rx::FrontEndCal_msg_rx() : gr::block("FrontEndCal_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"), boost::bind(&FrontEndCal_msg_rx::msg_handler_events, this, _1));
this->set_msg_handler(pmt::mp("events"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_events(PH1); });
#else
boost::bind(&FrontEndCal_msg_rx::msg_handler_events, this, _1));
#endif
rx_message = 0;
}