Boost logo

Boost Users :

Subject: [Boost-users] [Fusion] wide-char output
From: Leo Cacciari (leo.cacciari_at_[hidden])
Date: 2017-04-05 15:10:56


Hi,
the documentation of the Boost.Fusion library (1.63.0) at
http://www.boost.org/doc/libs/1_63_0/libs/fusion/doc/html/fusion/sequence/operator/i_o/out.html
affirms that operator<< is defined in the boost::fusion namespace with
the following synopsis:

         template <typename OStream, typename Sequence>
         OStream&
         operator<<(OStream& os, Sequence& seq);

where the template parameter OStream is defined as "An output stream".
Accordingly, I thought that the following would work:

    using boost::fusion::operator<<;
    fusion::vector<int, double, const char *> v =
fusion::make_vector(42, 3.1415, "foobar");
    std::wcout << "v = " << v << std::endl;

However, the compiler (MSVC 9) complains that it has:

"found no defined operator << taking a right-hand argument of type
boost::fusion::vector<T0,T1,T2> with T0 = int, T1 = double, T2 = char
*"

If I replace std::wcout with its narrow-char sibling std::cout,
everything works as expected; i.e. the code compiles and when run
prints (42,3.1415, foobar).

Looking into the source (file boost/fusion/sequence/io/out.hpp) it
seems that the operator<< is only defined for left-hand argument of
type std::ostream.

Thus the questions:

  1. Is this a bug and should I post a ticket about it? (I looked in
the bugs database but I couldn't find it)
  2. If it's a bug, are there any plan to patch it soon?
  3. If not, does exist any reason why it shouldn't be patched nevertheless?

If needed, I could volunteer for writing a patch.

Thank for your attention

-- 
Leo Cacciari
Aliae nationes servitutem pati possunt. Populi Romani est propria libertas.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net