Boost logo

Boost Users :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-01-26 06:36:40

gast128 wrote:

>An example is the counting iterator:
>const std::vector<int> values1(boost::make_counting_iterator(1),
>gives C4244. This is even harder to supress since the STL is included in the
>precompiled header.
This code should really not give you any warnings. (And doesn't on GCC,
though I doubt that'll help you.)
C4244, so that others don't have to look it up, is the "conversion with
possible data loss" warning. This indicates that in VC++,
make_counting_iterator returns a counting_iterator<long> or even
<__int64>. Can somebody with that compiler post the output of this line?
std::cout << typeid(boost::make_counting_iterator(1)).name() << std::endl;

A simple workaround for this particular warning ought to be to directly
instantiate counting_iterators with their template parameter set correctly.

Sebastian Redl

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at