Boost logo

Boost :

From: ChrisHines_at_[hidden]
Date: 2001-09-06 13:56:04


I am just getting started using the tokenizer library. First I'd
like to compliment John Bandela on this nice library. I had started
a similar project, but luckily I thought to check boost before I got
too far into it and was pleased to find a library that was exactly
what I had in mind.

I get warnings compiling the following program using MSVC (v6.0 SP5).

#include <string>
#include <iostream>
#include <boost/tokenizer.hpp>

int
main(int argc, char* argv[])
{
    std::string t = "Hello World!, This is awesome code.";
    boost::tokenizer<> tok(t);
    std::vector< std::string > words;
    std::copy(tok.begin(), tok.end(), std::back_inserter(words));

    std::vector< std::string >::const_iterator it = words.begin();
    while (it != words.end())
    {
        std::cout << *it++ << std::endl;
    }

    return 0;
}

The warnings I get are:

c:\myprojects\boost_1_24_0\boost\token_functions.hpp(256) : warning
C4800: 'const char *' : forcing value to bool 'true' or 'false'
(performance warning)
        c:\myprojects\boost_1_24_0\boost\token_functions.hpp(251) :
while compiling class-template member function '__thiscall
boost::char_delimiters_separator<char,struct std::char_traits<char>
>::boost::char_delimiters_separator<char,struct std::c
har_traits<char> >(bool,const char *,const char *)'
c:\myprojects\boost_1_24_0\boost\token_functions.hpp(256) : warning
C4800: 'const char *' : forcing value to bool 'true' or 'false'
(performance warning)
        c:\myprojects\boost_1_24_0\boost\token_functions.hpp(251) :
while compiling class-template member function '__thiscall
boost::char_delimiters_separator<char,struct std::char_traits<char>
>::boost::char_delimiters_separator<char,struct std::c
har_traits<char> >(bool,const char *,const char *)'

These warning can be eliminated by making the following changes in
char_delimiters_separator.

Change:

explicit char_delimiters_separator(bool return_delims = false,
  const Char * returnable = 0,const Char * nonreturnable = 0)
  :nonreturnable_(nonreturnable?nonreturnable:string_type().c_str()),
  returnable_(returnable?returnable:string_type().c_str()),
  no_ispunct_(returnable),no_isspace_(nonreturnable),
  return_delims_(return_delims){}

to:

explicit char_delimiters_separator(bool return_delims = false,
  const Char * returnable = 0,const Char * nonreturnable = 0)
  :nonreturnable_(nonreturnable?nonreturnable:string_type().c_str()),
  returnable_(returnable?returnable:string_type().c_str()),
  no_ispunct_(returnable != 0),no_isspace_(nonreturnable != 0),
  return_delims_(return_delims){}

This is my first time making a "bug" report to the boost effort. I
appologize in advance if I've broken any group protocols by posting
the information to this mailing list. I'd like to know if there is a
more appropriate forum or method.

    Chris Hines


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