Boost logo

Boost Users :

Subject: [Boost-users] lamba: QStringList <<
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-09-01 23:26:00


Hello,
the following for_each call with _1 fails to compile

      #include <QStringList.h>
      #include <boost/lambda/lambda.hpp>
      using namespace boost::lambda;
        QStringList items_list;
        std::for_each(begin_items(),end_items(), items_list << _1 );

QStringList has these << operators defined:
        QStringList& operator<< ( const QString& str );
        QStringList& operator<< ( const QStringList& other );

the type of item iterator returned by begin_items() is:
  const char* const*

QString has a ctor:
   QString (const char * str)

The compilation error is:
error C2678: binary '<<' : no operator found which takes a left-hand operand
of type 'const QStringList' (or there is no acceptable conversion)

I don't see why it tries to find a << that takes a ***const*** QStringList
left-hand operand?

Regards,


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