[PATCH] Replace BOOST_FOREACH with range-based for loops

argilo at gmail.com argilo at gmail.com
Fri Oct 23 01:36:24 UTC 2020


From: Clayton Smith <argilo at gmail.com>

Range-based for loops are available since C++11. Using them reduces
gr-osmosdr's dependence on Boost. Here I've done the replacement using a
global search-and-replace.
---
 lib/arg_helpers.h               |  13 ++--
 lib/bladerf/bladerf_common.cc   |   9 ++-
 lib/bladerf/bladerf_sink_c.cc   |   4 +-
 lib/bladerf/bladerf_source_c.cc |   4 +-
 lib/device.cc                   |  39 ++++++------
 lib/fcd/fcd_source_c.cc         |   3 +-
 lib/ranges.cc                   |  13 ++--
 lib/rfspace/rfspace_source_c.cc |   4 +-
 lib/sink_impl.cc                |  82 ++++++++++++------------
 lib/soapy/soapy_sink_c.cc       |  12 ++--
 lib/soapy/soapy_source_c.cc     |  12 ++--
 lib/source_impl.cc              | 108 ++++++++++++++++----------------
 lib/uhd/uhd_sink_c.cc           |  15 +++--
 lib/uhd/uhd_source_c.cc         |  15 +++--
 14 files changed, 163 insertions(+), 170 deletions(-)

diff --git a/lib/arg_helpers.h b/lib/arg_helpers.h
index b971625774..3b02b8ffb2 100644
--- a/lib/arg_helpers.h
+++ b/lib/arg_helpers.h
@@ -29,7 +29,6 @@
 
 #include <boost/lexical_cast.hpp>
 #include <boost/tokenizer.hpp>
-#include <boost/foreach.hpp>
 #include <ciso646>
 
 typedef std::map< std::string, std::string > dict_t;
@@ -38,7 +37,7 @@ typedef std::pair< std::string, std::string > pair_t;
 inline std::string dict_to_args_string( const dict_t &d )
 {
     std::string out;
-    BOOST_FOREACH(const pair_t pair, d)
+    for (const pair_t pair : d)
     {
         if (not out.empty()) out += ",";
         out += pair.first + "='" + pair.second + "'";
@@ -54,7 +53,7 @@ inline std::vector< std::string > args_to_vector( const std::string &args )
   typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
   tokenizer_t tokens(args, separator);
 
-  BOOST_FOREACH(std::string token, tokens)
+  for (std::string token : tokens)
     result.push_back(token);
 
   return result;
@@ -68,7 +67,7 @@ inline std::vector< std::string > params_to_vector( const std::string &params )
   typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
   tokenizer_t tokens(params, separator);
 
-  BOOST_FOREACH(std::string token, tokens)
+  for (std::string token : tokens)
     result.push_back(token);
 
   return result;
@@ -98,7 +97,7 @@ inline dict_t params_to_dict( const std::string &params )
   dict_t result;
 
   std::vector< std::string > param_list = params_to_vector( params );
-  BOOST_FOREACH(std::string param, param_list)
+  for (std::string param : param_list)
   {
     pair_t pair = param_to_pair( param );
     std::string value = pair.second;
@@ -124,7 +123,7 @@ inline gr::io_signature::sptr args_to_io_signature( const std::string &args )
   size_t dev_nchan = 0;
   std::vector< std::string > arg_list = args_to_vector( args );
 
-  BOOST_FOREACH( std::string arg, arg_list )
+  for (std::string arg : arg_list)
   {
     if ( arg.find( "numchan=" ) == 0 ) // try to parse global nchan value
     {
@@ -141,7 +140,7 @@ inline gr::io_signature::sptr args_to_io_signature( const std::string &args )
 
   // try to parse device specific nchan values, assume 1 channel if none given
 
-  BOOST_FOREACH( std::string arg, arg_list )
+  for (std::string arg : arg_list)
   {
     dict_t dict = params_to_dict(arg);
     if (dict.count("nchan"))
diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc
index 19b8a021a0..67bf736744 100644
--- a/lib/bladerf/bladerf_common.cc
+++ b/lib/bladerf/bladerf_common.cc
@@ -35,7 +35,6 @@
 #include <string>
 
 #include <boost/assign.hpp>
-#include <boost/foreach.hpp>
 #include <boost/format.hpp>
 #include <boost/lexical_cast.hpp>
 
@@ -498,7 +497,7 @@ int bladerf_common::channel2rfport(bladerf_channel ch)
 bladerf_channel bladerf_common::chan2channel(bladerf_direction direction,
                                              size_t chan)
 {
-  BOOST_FOREACH(bladerf_channel_map::value_type &i, _chanmap) {
+  for (bladerf_channel_map::value_type &i : _chanmap) {
     bladerf_channel ch = i.first;
     if (
         (i.second == (int)chan) && (
@@ -642,7 +641,7 @@ osmosdr::freq_range_t bladerf_common::filter_bandwidths(bladerf_channel ch)
       0.75, 0.875, 1.25, 1.375, 1.5, 1.92, 2.5,
       2.75, 3, 3.5, 4.375, 5, 6, 7, 10, 14;
 
-  BOOST_FOREACH( double half_bw, half_bandwidths )
+  for (double half_bw : half_bandwidths)
     bandwidths += osmosdr::range_t( half_bw * 2e6 );
 #else
 
@@ -1136,7 +1135,7 @@ bladerf_sptr bladerf_common::get_cached_device(struct bladerf_devinfo devinfo)
   int status;
   struct bladerf_devinfo other_devinfo;
 
-  BOOST_FOREACH(std::weak_ptr<struct bladerf> dev, _devs) {
+  for (std::weak_ptr<struct bladerf> dev : _devs) {
     status = bladerf_get_devinfo(bladerf_sptr(dev).get(), &other_devinfo);
     if (status < 0) {
       BLADERF_THROW_STATUS(status, "Failed to get devinfo for cached device");
@@ -1199,7 +1198,7 @@ void bladerf_common::print_device_info()
 bool bladerf_common::is_antenna_valid(bladerf_direction dir,
                                       const std::string &antenna)
 {
-  BOOST_FOREACH(std::string ant, get_antennas(dir)) {
+  for (std::string ant : get_antennas(dir)) {
     if (antenna == ant) {
       return true;
     }
diff --git a/lib/bladerf/bladerf_sink_c.cc b/lib/bladerf/bladerf_sink_c.cc
index fe64439d7b..6ee3acd927 100644
--- a/lib/bladerf/bladerf_sink_c.cc
+++ b/lib/bladerf/bladerf_sink_c.cc
@@ -96,7 +96,7 @@ bladerf_sink_c::bladerf_sink_c(const std::string &args) :
   }
 
   /* Initialize channel <-> antenna map */
-  BOOST_FOREACH(std::string ant, get_antennas()) {
+  for (std::string ant : get_antennas()) {
     _chanmap[str2channel(ant)] = -1;
   }
 
@@ -329,7 +329,7 @@ int bladerf_sink_c::transmit_with_tags(int16_t const *samples,
     }
   }
 
-  BOOST_FOREACH(gr::tag_t tag, tags) {
+  for (gr::tag_t tag : tags) {
     // Upon seeing an SOB tag, update our offset. We'll TX the start of the
     // burst when we see an EOB or at the end of this function - whichever
     // occurs first.
diff --git a/lib/bladerf/bladerf_source_c.cc b/lib/bladerf/bladerf_source_c.cc
index 2ac5779f2a..83db677a10 100644
--- a/lib/bladerf/bladerf_source_c.cc
+++ b/lib/bladerf/bladerf_source_c.cc
@@ -144,7 +144,7 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
   }
 
   /* Initialize channel <-> antenna map */
-  BOOST_FOREACH(std::string ant, get_antennas()) {
+  for (std::string ant : get_antennas()) {
     _chanmap[str2channel(ant)] = -1;
   }
 
@@ -180,7 +180,7 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
 
 bool bladerf_source_c::is_antenna_valid(const std::string &antenna)
 {
-  BOOST_FOREACH(std::string ant, get_antennas()) {
+  for (std::string ant : get_antennas()) {
     if (antenna == ant) {
       return true;
     }
diff --git a/lib/device.cc b/lib/device.cc
index 015383dbd4..17efde9896 100644
--- a/lib/device.cc
+++ b/lib/device.cc
@@ -20,7 +20,6 @@
 
 #include <osmosdr/device.h>
 #include <stdexcept>
-#include <boost/foreach.hpp>
 #include <boost/format.hpp>
 #include <algorithm>
 #include <mutex>
@@ -108,7 +107,7 @@ device_t::device_t(const std::string &args)
 {
   dict_t dict = params_to_dict(args);
 
-  BOOST_FOREACH( dict_t::value_type &entry, dict )
+  for (dict_t::value_type &entry : dict)
     (*this)[entry.first] = entry.second;
 }
 
@@ -118,7 +117,7 @@ std::string device_t::to_pp_string(void) const
 
   std::stringstream ss;
   ss << "Device Address:" << std::endl;
-  BOOST_FOREACH(const device_t::value_type &entry, *this) {
+  for (const device_t::value_type &entry : *this) {
     ss << boost::format("    %s: %s") % entry.first % entry.second << std::endl;
   }
   return ss.str();
@@ -128,7 +127,7 @@ std::string device_t::to_string(void) const
 {
   std::stringstream ss;
   size_t count = 0;
-  BOOST_FOREACH(const device_t::value_type &entry, *this) {
+  for (const device_t::value_type &entry : *this) {
     std::string value = entry.second;
     if (value.find(" ") != std::string::npos)
       value = "'" + value + "'";
@@ -151,55 +150,55 @@ devices_t device::find(const device_t &hint)
   devices_t devices;
 
 #ifdef ENABLE_OSMOSDR
-  BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() )
+  for (std::string dev : osmosdr_src_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_FCD
-  BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
+  for (std::string dev : fcd_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_RTL
-  BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() )
+  for (std::string dev : rtl_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_UHD
-  BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() )
+  for (std::string dev : uhd_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_MIRI
-  BOOST_FOREACH( std::string dev, miri_source_c::get_devices() )
+  for (std::string dev : miri_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_SDRPLAY
-  BOOST_FOREACH( std::string dev, sdrplay_source_c::get_devices() )
+  for (std::string dev : sdrplay_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_BLADERF
-  BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
+  for (std::string dev : bladerf_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_HACKRF
-  BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
+  for (std::string dev : hackrf_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_RFSPACE
-  BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices( fake ) )
+  for (std::string dev : rfspace_source_c::get_devices( fake ))
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_AIRSPY
-  BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() )
+  for (std::string dev : airspy_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_AIRSPYHF
-  BOOST_FOREACH( std::string dev, airspyhf_source_c::get_devices() )
+  for (std::string dev : airspyhf_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_FREESRP
-  BOOST_FOREACH( std::string dev, freesrp_source_c::get_devices() )
+  for (std::string dev : freesrp_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_SOAPY
-  BOOST_FOREACH( std::string dev, soapy_source_c::get_devices() )
+  for (std::string dev : soapy_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
 
@@ -208,15 +207,15 @@ devices_t device::find(const device_t &hint)
    * in a graphical interface etc... */
 
 #ifdef ENABLE_RTL_TCP
-  BOOST_FOREACH( std::string dev, rtl_tcp_source_c::get_devices( fake ) )
+  for (std::string dev : rtl_tcp_source_c::get_devices( fake ))
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_REDPITAYA
-  BOOST_FOREACH( std::string dev, redpitaya_source_c::get_devices( fake ) )
+  for (std::string dev : redpitaya_source_c::get_devices( fake ))
     devices.push_back( device_t(dev) );
 #endif
 #ifdef ENABLE_FILE
-  BOOST_FOREACH( std::string dev, file_source_c::get_devices( fake ) )
+  for (std::string dev : file_source_c::get_devices( fake ))
     devices.push_back( device_t(dev) );
 #endif
 
diff --git a/lib/fcd/fcd_source_c.cc b/lib/fcd/fcd_source_c.cc
index 744fa69553..854e4c0e04 100644
--- a/lib/fcd/fcd_source_c.cc
+++ b/lib/fcd/fcd_source_c.cc
@@ -23,7 +23,6 @@
 #include <sstream>
 
 #include <boost/assign.hpp>
-#include <boost/foreach.hpp>
 
 #include <gnuradio/io_signature.h>
 
@@ -171,7 +170,7 @@ std::vector< std::string > fcd_source_c::get_devices()
   int id = 0;
   std::vector< std::string > devices;
 
-  BOOST_FOREACH( device_t dev, _get_devices() )
+  for (device_t dev : _get_devices())
   {
     std::string args = "fcd=" + boost::lexical_cast< std::string >( id++ );
 
diff --git a/lib/ranges.cc b/lib/ranges.cc
index cdff96911a..09c1daedf5 100644
--- a/lib/ranges.cc
+++ b/lib/ranges.cc
@@ -18,7 +18,6 @@
 #include <osmosdr/ranges.h>
 #include <stdexcept>
 #include <boost/math/special_functions/round.hpp>
-#include <boost/foreach.hpp>
 #include <algorithm>
 #include <sstream>
 
@@ -102,7 +101,7 @@ meta_range_t::meta_range_t(
 double meta_range_t::start(void) const{
     check_meta_range_monotonic(*this);
     double min_start = this->front().start();
-    BOOST_FOREACH(const range_t &r, (*this)){
+    for (const range_t &r : (*this)){
         min_start = std::min(min_start, r.start());
     }
     return min_start;
@@ -111,7 +110,7 @@ double meta_range_t::start(void) const{
 double meta_range_t::stop(void) const{
     check_meta_range_monotonic(*this);
     double max_stop = this->front().stop();
-    BOOST_FOREACH(const range_t &r, (*this)){
+    for (const range_t &r : (*this)){
         max_stop = std::max(max_stop, r.stop());
     }
     return max_stop;
@@ -121,7 +120,7 @@ double meta_range_t::step(void) const{
     check_meta_range_monotonic(*this);
     std::vector<double> non_zero_steps;
     range_t last = this->front();
-    BOOST_FOREACH(const range_t &r, (*this)){
+    for (const range_t &r : (*this)){
         //steps at each range
         if (r.step() > 0) non_zero_steps.push_back(r.step());
         //and steps in-between ranges
@@ -137,7 +136,7 @@ double meta_range_t::step(void) const{
 double meta_range_t::clip(double value, bool clip_step) const{
     check_meta_range_monotonic(*this);
     double last_stop = this->front().stop();
-    BOOST_FOREACH(const range_t &r, (*this)){
+    for (const range_t &r : (*this)){
         //in-between ranges, clip to nearest
         if (value < r.start()){
             return (std::abs(value - r.start()) < std::abs(value - last_stop))?
@@ -157,7 +156,7 @@ double meta_range_t::clip(double value, bool clip_step) const{
 std::vector<double> meta_range_t::values() const {
     std::vector<double> values;
 
-    BOOST_FOREACH(const range_t &r, (*this)) {
+    for (const range_t &r : (*this)) {
         if (r.start() != r.stop()) {
             if ( r.step() == 0 ) {
                 values.push_back( r.start() );
@@ -177,7 +176,7 @@ std::vector<double> meta_range_t::values() const {
 
 const std::string meta_range_t::to_pp_string(void) const{
     std::stringstream ss;
-    BOOST_FOREACH(const range_t &r, (*this)){
+    for (const range_t &r : (*this)){
         ss << r.to_pp_string() << std::endl;
     }
     return ss.str();
diff --git a/lib/rfspace/rfspace_source_c.cc b/lib/rfspace/rfspace_source_c.cc
index 121dcde032..597bff6a96 100644
--- a/lib/rfspace/rfspace_source_c.cc
+++ b/lib/rfspace/rfspace_source_c.cc
@@ -1296,7 +1296,7 @@ std::vector<std::string> rfspace_source_c::get_devices( bool fake )
 
   std::vector < unit_t > units = discover_netsdr();
 
-  BOOST_FOREACH( unit_t u, units )
+  for (unit_t u : units)
   {
 //    std::cerr << u.name << " " << u.sn << " " << u.addr <<  ":" << u.port
 //              << std::endl;
@@ -1310,7 +1310,7 @@ std::vector<std::string> rfspace_source_c::get_devices( bool fake )
 
   units = discover_sdr_iq();
 
-  BOOST_FOREACH( unit_t u, units )
+  for (unit_t u : units)
   {
 //    std::cerr << u.name << " " << u.sn << " " << u.addr <<  ":" << u.port
 //              << std::endl;
diff --git a/lib/sink_impl.cc b/lib/sink_impl.cc
index e8f8dc076d..a09d7df14b 100644
--- a/lib/sink_impl.cc
+++ b/lib/sink_impl.cc
@@ -107,13 +107,13 @@ sink_impl::sink_impl( const std::string &args )
             << GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
             << "gnuradio " << gr::version() << std::endl;
   std::cerr << "built-in sink types: ";
-  BOOST_FOREACH(std::string dev_type, dev_types)
+  for (std::string dev_type : dev_types)
     std::cerr << dev_type << " ";
   std::cerr << std::endl;
 
-  BOOST_FOREACH(std::string arg, arg_list) {
+  for (std::string arg : arg_list) {
     dict_t dict = params_to_dict(arg);
-    BOOST_FOREACH(std::string dev_type, dev_types) {
+    for (std::string dev_type : dev_types) {
       if ( dict.count( dev_type ) ) {
         device_specified = true;
         break;
@@ -124,36 +124,36 @@ sink_impl::sink_impl( const std::string &args )
   if ( ! device_specified ) {
     std::vector< std::string > dev_list;
 #ifdef ENABLE_UHD
-    BOOST_FOREACH( std::string dev, uhd_sink_c::get_devices() )
+    for (std::string dev : uhd_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_BLADERF
-    BOOST_FOREACH( std::string dev, bladerf_sink_c::get_devices() )
+    for (std::string dev : bladerf_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_HACKRF
-    BOOST_FOREACH( std::string dev, hackrf_sink_c::get_devices() )
+    for (std::string dev : hackrf_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_SOAPY
-    BOOST_FOREACH( std::string dev, soapy_sink_c::get_devices() )
+    for (std::string dev : soapy_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_REDPITAYA
-    BOOST_FOREACH( std::string dev, redpitaya_sink_c::get_devices() )
+    for (std::string dev : redpitaya_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_FREESRP
-    BOOST_FOREACH( std::string dev, freesrp_sink_c::get_devices() )
+    for (std::string dev : freesrp_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_FILE
-    BOOST_FOREACH( std::string dev, file_sink_c::get_devices() )
+    for (std::string dev : file_sink_c::get_devices())
       dev_list.push_back( dev );
 #endif
 
 //    std::cerr << std::endl;
-//    BOOST_FOREACH( std::string dev, dev_list )
+//    for (std::string dev : dev_list)
 //      std::cerr << "'" << dev << "'" << std::endl;
 
     if ( dev_list.size() )
@@ -162,12 +162,12 @@ sink_impl::sink_impl( const std::string &args )
       throw std::runtime_error("No supported devices found (check the connection and/or udev rules).");
   }
 
-  BOOST_FOREACH(std::string arg, arg_list) {
+  for (std::string arg : arg_list) {
 
     dict_t dict = params_to_dict(arg);
 
 //    std::cerr << std::endl;
-//    BOOST_FOREACH( dict_t::value_type &entry, dict )
+//    for (dict_t::value_type &entry : dict)
 //      std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
 
     sink_iface *iface = NULL;
@@ -235,7 +235,7 @@ size_t sink_impl::get_num_channels()
 {
   size_t channels = 0;
 
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     channels += dev->get_num_channels();
 
   return channels;
@@ -263,7 +263,7 @@ double sink_impl::set_sample_rate(double rate)
     if (_devs.empty())
       throw std::runtime_error(NO_DEVICES_MSG);
 #endif
-    BOOST_FOREACH( sink_iface *dev, _devs )
+    for (sink_iface *dev : _devs)
       sample_rate = dev->set_sample_rate(rate);
 
     _sample_rate = sample_rate;
@@ -288,7 +288,7 @@ double sink_impl::get_sample_rate()
 osmosdr::freq_range_t sink_impl::get_freq_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_freq_range( dev_chan );
@@ -299,7 +299,7 @@ osmosdr::freq_range_t sink_impl::get_freq_range( size_t chan )
 double sink_impl::set_center_freq( double freq, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _center_freq[ chan ] != freq ) {
@@ -314,7 +314,7 @@ double sink_impl::set_center_freq( double freq, size_t chan )
 double sink_impl::get_center_freq( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_center_freq( dev_chan );
@@ -325,7 +325,7 @@ double sink_impl::get_center_freq( size_t chan )
 double sink_impl::set_freq_corr( double ppm, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _freq_corr[ chan ] != ppm ) {
@@ -340,7 +340,7 @@ double sink_impl::set_freq_corr( double ppm, size_t chan )
 double sink_impl::get_freq_corr( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_freq_corr( dev_chan );
@@ -351,7 +351,7 @@ double sink_impl::get_freq_corr( size_t chan )
 std::vector<std::string> sink_impl::get_gain_names( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_names( dev_chan );
@@ -362,7 +362,7 @@ std::vector<std::string> sink_impl::get_gain_names( size_t chan )
 osmosdr::gain_range_t sink_impl::get_gain_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_range( dev_chan );
@@ -373,7 +373,7 @@ osmosdr::gain_range_t sink_impl::get_gain_range( size_t chan )
 osmosdr::gain_range_t sink_impl::get_gain_range( const std::string & name, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_range( name, dev_chan );
@@ -384,7 +384,7 @@ osmosdr::gain_range_t sink_impl::get_gain_range( const std::string & name, size_
 bool sink_impl::set_gain_mode( bool automatic, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _gain_mode[ chan ] != automatic ) {
@@ -402,7 +402,7 @@ bool sink_impl::set_gain_mode( bool automatic, size_t chan )
 bool sink_impl::get_gain_mode( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_mode( dev_chan );
@@ -413,7 +413,7 @@ bool sink_impl::get_gain_mode( size_t chan )
 double sink_impl::set_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _gain[ chan ] != gain ) {
@@ -428,7 +428,7 @@ double sink_impl::set_gain( double gain, size_t chan )
 double sink_impl::set_gain( double gain, const std::string & name, size_t chan)
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->set_gain( gain, name, dev_chan );
@@ -439,7 +439,7 @@ double sink_impl::set_gain( double gain, const std::string & name, size_t chan)
 double sink_impl::get_gain( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain( dev_chan );
@@ -450,7 +450,7 @@ double sink_impl::get_gain( size_t chan )
 double sink_impl::get_gain( const std::string & name, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain( name, dev_chan );
@@ -461,7 +461,7 @@ double sink_impl::get_gain( const std::string & name, size_t chan )
 double sink_impl::set_if_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _if_gain[ chan ] != gain ) {
@@ -476,7 +476,7 @@ double sink_impl::set_if_gain( double gain, size_t chan )
 double sink_impl::set_bb_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _bb_gain[ chan ] != gain ) {
@@ -491,7 +491,7 @@ double sink_impl::set_bb_gain( double gain, size_t chan )
 std::vector< std::string > sink_impl::get_antennas( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_antennas( dev_chan );
@@ -502,7 +502,7 @@ std::vector< std::string > sink_impl::get_antennas( size_t chan )
 std::string sink_impl::set_antenna( const std::string & antenna, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _antenna[ chan ] != antenna ) {
@@ -517,7 +517,7 @@ std::string sink_impl::set_antenna( const std::string & antenna, size_t chan )
 std::string sink_impl::get_antenna( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_antenna( dev_chan );
@@ -528,7 +528,7 @@ std::string sink_impl::get_antenna( size_t chan )
 void sink_impl::set_dc_offset( const std::complex<double> &offset, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         dev->set_dc_offset( offset, dev_chan );
@@ -537,7 +537,7 @@ void sink_impl::set_dc_offset( const std::complex<double> &offset, size_t chan )
 void sink_impl::set_iq_balance( const std::complex<double> &balance, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         dev->set_iq_balance( balance, dev_chan );
@@ -546,7 +546,7 @@ void sink_impl::set_iq_balance( const std::complex<double> &balance, size_t chan
 double sink_impl::set_bandwidth( double bandwidth, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _bandwidth[ chan ] != bandwidth || 0.0f == bandwidth ) {
@@ -561,7 +561,7 @@ double sink_impl::set_bandwidth( double bandwidth, size_t chan )
 double sink_impl::get_bandwidth( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_bandwidth( dev_chan );
@@ -572,7 +572,7 @@ double sink_impl::get_bandwidth( size_t chan )
 osmosdr::freq_range_t sink_impl::get_bandwidth_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_bandwidth_range( dev_chan );
@@ -665,7 +665,7 @@ void sink_impl::set_time_now(const osmosdr::time_spec_t &time_spec, size_t mboar
 
 void sink_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
 {
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
   {
     dev->set_time_next_pps( time_spec );
   }
@@ -673,7 +673,7 @@ void sink_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
 
 void sink_impl::set_time_unknown_pps(const osmosdr::time_spec_t &time_spec)
 {
-  BOOST_FOREACH( sink_iface *dev, _devs )
+  for (sink_iface *dev : _devs)
   {
     dev->set_time_unknown_pps( time_spec );
   }
diff --git a/lib/soapy/soapy_sink_c.cc b/lib/soapy/soapy_sink_c.cc
index e4422f7f45..4aafc47203 100644
--- a/lib/soapy/soapy_sink_c.cc
+++ b/lib/soapy/soapy_sink_c.cc
@@ -107,7 +107,7 @@ std::vector<std::string> soapy_sink_c::get_devices()
 {
     std::vector<std::string> result;
     int i = 0;
-    BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
+    for (SoapySDR::Kwargs kw : SoapySDR::Device::enumerate())
     {
         kw["soapy"] = boost::lexical_cast<std::string>(i++);
         result.push_back(dict_to_args_string(kw));
@@ -124,12 +124,12 @@ osmosdr::meta_range_t soapy_sink_c::get_sample_rates( void )
 {
     osmosdr::meta_range_t result;
     #ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
-    BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_TX, 0))
+    for (const SoapySDR::Range &r : _device->getSampleRateRange(SOAPY_SDR_TX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
     #else
-    BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_TX, 0))
+    for (const double rate : _device->listSampleRates(SOAPY_SDR_TX, 0))
     {
         result.push_back(osmosdr::range_t(rate));
     }
@@ -151,7 +151,7 @@ double soapy_sink_c::get_sample_rate( void )
 osmosdr::freq_range_t soapy_sink_c::get_freq_range( size_t chan)
 {
     osmosdr::meta_range_t result;
-    BOOST_FOREACH(const SoapySDR::Range r, _device->getFrequencyRange(SOAPY_SDR_TX, 0))
+    for (const SoapySDR::Range r : _device->getFrequencyRange(SOAPY_SDR_TX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
@@ -309,12 +309,12 @@ osmosdr::freq_range_t soapy_sink_c::get_bandwidth_range( size_t chan)
 {
     osmosdr::meta_range_t result;
     #ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
-    BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_TX, 0))
+    for (const SoapySDR::Range &r : _device->getBandwidthRange(SOAPY_SDR_TX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
     #else
-    BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_TX, 0))
+    for (const double bw : _device->listBandwidths(SOAPY_SDR_TX, 0))
     {
         result.push_back(osmosdr::range_t(bw));
     }
diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc
index 4056a508a0..4dc9efc019 100644
--- a/lib/soapy/soapy_source_c.cc
+++ b/lib/soapy/soapy_source_c.cc
@@ -113,7 +113,7 @@ std::vector<std::string> soapy_source_c::get_devices()
 {
     std::vector<std::string> result;
     int i = 0;
-    BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
+    for (SoapySDR::Kwargs kw : SoapySDR::Device::enumerate())
     {
         kw["soapy"] = boost::lexical_cast<std::string>(i++);
         result.push_back(dict_to_args_string(kw));
@@ -130,12 +130,12 @@ osmosdr::meta_range_t soapy_source_c::get_sample_rates( void )
 {
     osmosdr::meta_range_t result;
     #ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
-    BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_RX, 0))
+    for (const SoapySDR::Range &r : _device->getSampleRateRange(SOAPY_SDR_RX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
     #else
-    BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_RX, 0))
+    for (const double rate : _device->listSampleRates(SOAPY_SDR_RX, 0))
     {
         result.push_back(osmosdr::range_t(rate));
     }
@@ -157,7 +157,7 @@ double soapy_source_c::get_sample_rate( void )
 osmosdr::freq_range_t soapy_source_c::get_freq_range( size_t chan )
 {
     osmosdr::meta_range_t result;
-    BOOST_FOREACH(const SoapySDR::Range r, _device->getFrequencyRange(SOAPY_SDR_RX, 0))
+    for (const SoapySDR::Range r : _device->getFrequencyRange(SOAPY_SDR_RX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
@@ -338,12 +338,12 @@ osmosdr::freq_range_t soapy_source_c::get_bandwidth_range( size_t chan )
 {
     osmosdr::meta_range_t result;
     #ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
-    BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_RX, 0))
+    for (const SoapySDR::Range &r : _device->getBandwidthRange(SOAPY_SDR_RX, 0))
     {
         result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
     }
     #else
-    BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_RX, 0))
+    for (const double bw : _device->listBandwidths(SOAPY_SDR_RX, 0))
     {
         result.push_back(osmosdr::range_t(bw));
     }
diff --git a/lib/source_impl.cc b/lib/source_impl.cc
index f1426e0e0b..41c45bf467 100644
--- a/lib/source_impl.cc
+++ b/lib/source_impl.cc
@@ -177,7 +177,7 @@ source_impl::source_impl( const std::string &args )
             << GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
             << "gnuradio " << gr::version() << std::endl;
   std::cerr << "built-in source types: ";
-  BOOST_FOREACH(std::string dev_type, dev_types)
+  for (std::string dev_type : dev_types)
     std::cerr << dev_type << " ";
   std::cerr << std::endl;
 
@@ -188,9 +188,9 @@ source_impl::source_impl( const std::string &args )
   dev_types.push_back("cloudiq");
 #endif
 
-  BOOST_FOREACH(std::string arg, arg_list) {
+  for (std::string arg : arg_list) {
     dict_t dict = params_to_dict(arg);
-    BOOST_FOREACH(std::string dev_type, dev_types) {
+    for (std::string dev_type : dev_types) {
       if ( dict.count( dev_type ) ) {
         device_specified = true;
         break;
@@ -201,64 +201,64 @@ source_impl::source_impl( const std::string &args )
   if ( ! device_specified ) {
     std::vector< std::string > dev_list;
 #ifdef ENABLE_OSMOSDR
-    BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() )
+    for (std::string dev : osmosdr_src_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_FCD
-    BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
+    for (std::string dev : fcd_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_RTL
-    BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() )
+    for (std::string dev : rtl_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_UHD
-    BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() )
+    for (std::string dev : uhd_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_MIRI
-    BOOST_FOREACH( std::string dev, miri_source_c::get_devices() )
+    for (std::string dev : miri_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_SDRPLAY
-    BOOST_FOREACH( std::string dev, sdrplay_source_c::get_devices() )
+    for (std::string dev : sdrplay_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_BLADERF
-    BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
+    for (std::string dev : bladerf_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_RFSPACE
-    BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() )
+    for (std::string dev : rfspace_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_HACKRF
-    BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
+    for (std::string dev : hackrf_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_AIRSPY
-    BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() )
+    for (std::string dev : airspy_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_AIRSPYHF
-    BOOST_FOREACH( std::string dev, airspyhf_source_c::get_devices() )
+    for (std::string dev : airspyhf_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_SOAPY
-    BOOST_FOREACH( std::string dev, soapy_source_c::get_devices() )
+    for (std::string dev : soapy_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_REDPITAYA
-    BOOST_FOREACH( std::string dev, redpitaya_source_c::get_devices() )
+    for (std::string dev : redpitaya_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 #ifdef ENABLE_FREESRP
-    BOOST_FOREACH( std::string dev, freesrp_source_c::get_devices() )
+    for (std::string dev : freesrp_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
 
 //    std::cerr << std::endl;
-//    BOOST_FOREACH( std::string dev, dev_list )
+//    for (std::string dev : dev_list)
 //      std::cerr << "'" << dev << "'" << std::endl;
 
     if ( dev_list.size() )
@@ -267,12 +267,12 @@ source_impl::source_impl( const std::string &args )
       throw std::runtime_error("No supported devices found (check the connection and/or udev rules).");
   }
 
-  BOOST_FOREACH(std::string arg, arg_list) {
+  for (std::string arg : arg_list) {
 
     dict_t dict = params_to_dict(arg);
 
 //    std::cerr << std::endl;
-//    BOOST_FOREACH( dict_t::value_type &entry, dict )
+//    for (dict_t::value_type &entry : dict)
 //      std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
 
     source_iface *iface = NULL;
@@ -427,7 +427,7 @@ size_t source_impl::get_num_channels()
 {
   size_t channels = 0;
 
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     channels += dev->get_num_channels();
 
   return channels;
@@ -436,7 +436,7 @@ size_t source_impl::get_num_channels()
 bool source_impl::seek( long seek_point, int whence, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->seek( seek_point, whence, dev_chan );
@@ -466,12 +466,12 @@ double source_impl::set_sample_rate(double rate)
     if (_devs.empty())
       throw std::runtime_error(NO_DEVICES_MSG);
 #endif
-    BOOST_FOREACH( source_iface *dev, _devs )
+    for (source_iface *dev : _devs)
       sample_rate = dev->set_sample_rate(rate);
 
 #ifdef HAVE_IQBALANCE
     size_t channel = 0;
-    BOOST_FOREACH( source_iface *dev, _devs ) {
+    for (source_iface *dev : _devs) {
       for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
         if ( channel < _iq_opt.size() ) {
           gr::iqbalance::optimize_c *opt = _iq_opt[channel];
@@ -509,7 +509,7 @@ double source_impl::get_sample_rate()
 osmosdr::freq_range_t source_impl::get_freq_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_freq_range( dev_chan );
@@ -520,7 +520,7 @@ osmosdr::freq_range_t source_impl::get_freq_range( size_t chan )
 double source_impl::set_center_freq( double freq, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _center_freq[ chan ] != freq ) {
@@ -535,7 +535,7 @@ double source_impl::set_center_freq( double freq, size_t chan )
 double source_impl::get_center_freq( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_center_freq( dev_chan );
@@ -546,7 +546,7 @@ double source_impl::get_center_freq( size_t chan )
 double source_impl::set_freq_corr( double ppm, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _freq_corr[ chan ] != ppm ) {
@@ -561,7 +561,7 @@ double source_impl::set_freq_corr( double ppm, size_t chan )
 double source_impl::get_freq_corr( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_freq_corr( dev_chan );
@@ -572,7 +572,7 @@ double source_impl::get_freq_corr( size_t chan )
 std::vector<std::string> source_impl::get_gain_names( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_names( dev_chan );
@@ -583,7 +583,7 @@ std::vector<std::string> source_impl::get_gain_names( size_t chan )
 osmosdr::gain_range_t source_impl::get_gain_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_range( dev_chan );
@@ -594,7 +594,7 @@ osmosdr::gain_range_t source_impl::get_gain_range( size_t chan )
 osmosdr::gain_range_t source_impl::get_gain_range( const std::string & name, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_range( name, dev_chan );
@@ -605,7 +605,7 @@ osmosdr::gain_range_t source_impl::get_gain_range( const std::string & name, siz
 bool source_impl::set_gain_mode( bool automatic, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _gain_mode[ chan ] != automatic ) {
@@ -623,7 +623,7 @@ bool source_impl::set_gain_mode( bool automatic, size_t chan )
 bool source_impl::get_gain_mode( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain_mode( dev_chan );
@@ -634,7 +634,7 @@ bool source_impl::get_gain_mode( size_t chan )
 double source_impl::set_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _gain[ chan ] != gain ) {
@@ -649,7 +649,7 @@ double source_impl::set_gain( double gain, size_t chan )
 double source_impl::set_gain( double gain, const std::string & name, size_t chan)
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->set_gain( gain, name, dev_chan );
@@ -660,7 +660,7 @@ double source_impl::set_gain( double gain, const std::string & name, size_t chan
 double source_impl::get_gain( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain( dev_chan );
@@ -671,7 +671,7 @@ double source_impl::get_gain( size_t chan )
 double source_impl::get_gain( const std::string & name, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_gain( name, dev_chan );
@@ -682,7 +682,7 @@ double source_impl::get_gain( const std::string & name, size_t chan )
 double source_impl::set_if_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _if_gain[ chan ] != gain ) {
@@ -697,7 +697,7 @@ double source_impl::set_if_gain( double gain, size_t chan )
 double source_impl::set_bb_gain( double gain, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _bb_gain[ chan ] != gain ) {
@@ -712,7 +712,7 @@ double source_impl::set_bb_gain( double gain, size_t chan )
 std::vector< std::string > source_impl::get_antennas( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_antennas( dev_chan );
@@ -723,7 +723,7 @@ std::vector< std::string > source_impl::get_antennas( size_t chan )
 std::string source_impl::set_antenna( const std::string & antenna, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _antenna[ chan ] != antenna ) {
@@ -738,7 +738,7 @@ std::string source_impl::set_antenna( const std::string & antenna, size_t chan )
 std::string source_impl::get_antenna( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_antenna( dev_chan );
@@ -749,7 +749,7 @@ std::string source_impl::get_antenna( size_t chan )
 void source_impl::set_dc_offset_mode( int mode, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         dev->set_dc_offset_mode( mode, dev_chan );
@@ -758,7 +758,7 @@ void source_impl::set_dc_offset_mode( int mode, size_t chan )
 void source_impl::set_dc_offset( const std::complex<double> &offset, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         dev->set_dc_offset( offset, dev_chan );
@@ -768,7 +768,7 @@ void source_impl::set_iq_balance_mode( int mode, size_t chan )
 {
   size_t channel = 0;
 #ifdef HAVE_IQBALANCE
-  BOOST_FOREACH( source_iface *dev, _devs ) {
+  for (source_iface *dev : _devs) {
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
       if ( chan == channel++ ) {
         if ( chan < _iq_opt.size() && chan < _iq_fix.size() ) {
@@ -798,7 +798,7 @@ void source_impl::set_iq_balance_mode( int mode, size_t chan )
     }
   }
 #else
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->set_iq_balance_mode( mode, dev_chan );
@@ -809,7 +809,7 @@ void source_impl::set_iq_balance( const std::complex<double> &balance, size_t ch
 {
   size_t channel = 0;
 #ifdef HAVE_IQBALANCE
-  BOOST_FOREACH( source_iface *dev, _devs ) {
+  for (source_iface *dev : _devs) {
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
       if ( chan == channel++ ) {
         if ( chan < _iq_opt.size() && chan < _iq_fix.size() ) {
@@ -825,7 +825,7 @@ void source_impl::set_iq_balance( const std::complex<double> &balance, size_t ch
     }
   }
 #else
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->set_iq_balance( balance, dev_chan );
@@ -835,7 +835,7 @@ void source_impl::set_iq_balance( const std::complex<double> &balance, size_t ch
 double source_impl::set_bandwidth( double bandwidth, size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ ) {
         if ( _bandwidth[ chan ] != bandwidth || 0.0f == bandwidth ) {
@@ -850,7 +850,7 @@ double source_impl::set_bandwidth( double bandwidth, size_t chan )
 double source_impl::get_bandwidth( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_bandwidth( dev_chan );
@@ -861,7 +861,7 @@ double source_impl::get_bandwidth( size_t chan )
 osmosdr::freq_range_t source_impl::get_bandwidth_range( size_t chan )
 {
   size_t channel = 0;
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
     for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
       if ( chan == channel++ )
         return dev->get_bandwidth_range( dev_chan );
@@ -954,7 +954,7 @@ void source_impl::set_time_now(const osmosdr::time_spec_t &time_spec, size_t mbo
 
 void source_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
 {
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
   {
     dev->set_time_next_pps( time_spec );
   }
@@ -962,7 +962,7 @@ void source_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
 
 void source_impl::set_time_unknown_pps(const osmosdr::time_spec_t &time_spec)
 {
-  BOOST_FOREACH( source_iface *dev, _devs )
+  for (source_iface *dev : _devs)
   {
     dev->set_time_unknown_pps( time_spec );
   }
diff --git a/lib/uhd/uhd_sink_c.cc b/lib/uhd/uhd_sink_c.cc
index a154556fc0..8698f4c2f5 100644
--- a/lib/uhd/uhd_sink_c.cc
+++ b/lib/uhd/uhd_sink_c.cc
@@ -18,7 +18,6 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/assign.hpp>
 #include <boost/algorithm/string.hpp>
 
@@ -71,7 +70,7 @@ uhd_sink_c::uhd_sink_c(const std::string &args) :
     _lo_offset = boost::lexical_cast< double >( dict["lo_offset"] );
 
   std::string arguments; // rebuild argument string without internal arguments
-  BOOST_FOREACH( dict_t::value_type &entry, dict )
+  for (dict_t::value_type &entry : dict)
   {
     if ( "cpu_format" == entry.first ||
          "otw_format" == entry.first ||
@@ -135,7 +134,7 @@ std::vector< std::string > uhd_sink_c::get_devices()
   std::vector< std::string > devices;
 
   uhd::device_addr_t hint;
-  BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
+  for (const uhd::device_addr_t &dev : uhd::device::find(hint))
   {
     std::string args = "uhd," + dev.to_string();
 
@@ -190,7 +189,7 @@ osmosdr::meta_range_t uhd_sink_c::get_sample_rates( void )
 {
   osmosdr::meta_range_t rates;
 
-  BOOST_FOREACH( uhd::range_t rate, _snk->get_samp_rates() )
+  for (uhd::range_t rate : _snk->get_samp_rates())
       rates += osmosdr::range_t( rate.start(), rate.stop(), rate.step() );
 
   return rates;
@@ -211,7 +210,7 @@ osmosdr::freq_range_t uhd_sink_c::get_freq_range( size_t chan )
 {
   osmosdr::freq_range_t range;
 
-  BOOST_FOREACH( uhd::range_t freq, _snk->get_freq_range(chan) )
+  for (uhd::range_t freq : _snk->get_freq_range(chan))
       range += osmosdr::range_t( freq.start(), freq.stop(), freq.step() );
 
   return range;
@@ -260,7 +259,7 @@ osmosdr::gain_range_t uhd_sink_c::get_gain_range( size_t chan )
 {
   osmosdr::gain_range_t range;
 
-  BOOST_FOREACH( uhd::range_t gain, _snk->get_gain_range(chan) )
+  for (uhd::range_t gain : _snk->get_gain_range(chan))
       range += osmosdr::range_t( gain.start(), gain.stop(), gain.step() );
 
   return range;
@@ -270,7 +269,7 @@ osmosdr::gain_range_t uhd_sink_c::get_gain_range( const std::string & name, size
 {
   osmosdr::gain_range_t range;
 
-  BOOST_FOREACH( uhd::range_t gain, _snk->get_gain_range(name, chan) )
+  for (uhd::range_t gain : _snk->get_gain_range(name, chan))
       range += osmosdr::range_t( gain.start(), gain.stop(), gain.step() );
 
   return range;
@@ -351,7 +350,7 @@ osmosdr::freq_range_t uhd_sink_c::get_bandwidth_range( size_t chan )
 {
   osmosdr::freq_range_t bandwidths;
 
-  BOOST_FOREACH( uhd::range_t bw, _snk->get_bandwidth_range(chan) )
+  for (uhd::range_t bw : _snk->get_bandwidth_range(chan))
       bandwidths += osmosdr::range_t( bw.start(), bw.stop(), bw.step() );
 
   return bandwidths;
diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc
index fc1301746e..f9f9fdd620 100644
--- a/lib/uhd/uhd_source_c.cc
+++ b/lib/uhd/uhd_source_c.cc
@@ -18,7 +18,6 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/assign.hpp>
 #include <boost/algorithm/string.hpp>
 
@@ -72,7 +71,7 @@ uhd_source_c::uhd_source_c(const std::string &args) :
     _lo_offset = boost::lexical_cast< double >( dict["lo_offset"] );
 
   std::string arguments; // rebuild argument string without internal arguments
-  BOOST_FOREACH( dict_t::value_type &entry, dict )
+  for (dict_t::value_type &entry : dict)
   {
     if ( "cpu_format" == entry.first ||
          "otw_format" == entry.first ||
@@ -136,7 +135,7 @@ std::vector< std::string > uhd_source_c::get_devices()
   std::vector< std::string > devices;
 
   uhd::device_addr_t hint;
-  BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
+  for (const uhd::device_addr_t &dev : uhd::device::find(hint))
   {
     std::string args = "uhd," + dev.to_string();
 
@@ -191,7 +190,7 @@ osmosdr::meta_range_t uhd_source_c::get_sample_rates( void )
 {
   osmosdr::meta_range_t rates;
 
-  BOOST_FOREACH( uhd::range_t rate, _src->get_samp_rates() )
+  for (uhd::range_t rate : _src->get_samp_rates())
       rates += osmosdr::range_t( rate.start(), rate.stop(), rate.step() );
 
   return rates;
@@ -212,7 +211,7 @@ osmosdr::freq_range_t uhd_source_c::get_freq_range( size_t chan )
 {
   osmosdr::freq_range_t range;
 
-  BOOST_FOREACH( uhd::range_t freq, _src->get_freq_range(chan) )
+  for (uhd::range_t freq : _src->get_freq_range(chan))
       range += osmosdr::range_t( freq.start(), freq.stop(), freq.step() );
 
   return range;
@@ -261,7 +260,7 @@ osmosdr::gain_range_t uhd_source_c::get_gain_range( size_t chan )
 {
   osmosdr::gain_range_t range;
 
-  BOOST_FOREACH( uhd::range_t gain, _src->get_gain_range(chan) )
+  for (uhd::range_t gain : _src->get_gain_range(chan))
       range += osmosdr::range_t( gain.start(), gain.stop(), gain.step() );
 
   return range;
@@ -271,7 +270,7 @@ osmosdr::gain_range_t uhd_source_c::get_gain_range( const std::string & name, si
 {
   osmosdr::gain_range_t range;
 
-  BOOST_FOREACH( uhd::range_t gain, _src->get_gain_range(name, chan) )
+  for (uhd::range_t gain : _src->get_gain_range(name, chan))
       range += osmosdr::range_t( gain.start(), gain.stop(), gain.step() );
 
   return range;
@@ -383,7 +382,7 @@ osmosdr::freq_range_t uhd_source_c::get_bandwidth_range( size_t chan )
 {
   osmosdr::freq_range_t bandwidths;
 
-  BOOST_FOREACH( uhd::range_t bw, _src->get_bandwidth_range(chan) )
+  for (uhd::range_t bw : _src->get_bandwidth_range(chan))
       bandwidths += osmosdr::range_t( bw.start(), bw.stop(), bw.step() );
 
   return bandwidths;
-- 
2.25.1



More information about the osmocom-sdr mailing list