Boost logo

Boost :

Subject: [boost] [LOG] formatting_ostream API change
From: Andrew Hundt (athundt_at_[hidden])
Date: 2015-11-09 12:20:16


I had the following code, which worked in 1.58:

#include <boost/log/trivial.hpp>

#include <boost/exception/all.hpp>

#include <boost/algorithm/string.hpp>

/// @todo move elsewhere, because it will conflict with others'
implementations of outputting vectors

template<typename T>

inline boost::log::formatting_ostream& operator<<(boost::log::
formatting_ostream& out, std::vector<T>& v)

{

    out << "[";

    size_t last = v.size() - 1;

    for(size_t i = 0; i < v.size(); ++i) {

        out << v[i];

        if (i != last)

            out << ", ";

    }

    out << "]";

    return out;

}

I used it to output a std::vector<float> as follows:

 BOOST_LOG_TRIVIAL(trace) << “Real joint angles from FRI: " <<
realJointPosition << "\n";

However this now seems to fail in 1.59. I’ve created a github gist with the
compiler output <https://gist.github.com/ahundt/5869dbd09e889b7153c3> in
case that’s helpful as well. I see that the update recently had some
breaking changes, what is the new way to provide the desired functionality?

Thanks for your help.

Cheers!
Andrew Hundt


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk