Subject: [Boost-bugs] [Boost C++ Libraries] #6961: problem with list_c et.all
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-03 17:55:46
#6961: problem with list_c et.all
------------------------------+---------------------------------------------
Reporter: ramey | Owner: agurtovoy
Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpl
Version: Boost 1.49.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
The documentation for list_c states that it is a model of Front Extensible
Sequence.
But some simple testing suggests otherwise. Here is my test program:
{{{
#include "../include/multi_precision.hpp"
//#include <boost/mpl/shift_right.hpp>
//#include <boost/mpl/integral_c.hpp>
//#include <boost/cstdint.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/list_c.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/print.hpp>
namespace boost {
namespace mpl {
print<
list_c<int,
22,
64
>
> x8;
print<
front<
list_c<int,
22,
64
>
>::type
> x7;
print<
push_front<
list_c<int,
22,
64
>,
integral_c<int, 33>
>::type
> x6;
}}}
which produces the following output on my VC 9.0 compiler
{{{
1>------ Build started: Project: test_interval, Configuration: Debug Win32
------
1>Compiling...
1>test_multi_precision.cpp
1>c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative
integral constant converted to unsigned type
1> c:\projects\boost
projects\mpl\tests\test_multi_precision.cpp(24) : see reference to class
template instantiation 'boost::mpl::print<T>' being compiled
1> with
1> [
1> T=boost::mpl::list_c<int,22,64>
1> ]
1>c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative
integral constant converted to unsigned type
1> c:\projects\boost
projects\mpl\tests\test_multi_precision.cpp(33) : see reference to class
template instantiation 'boost::mpl::print<T>' being compiled
1> with
1> [
1> T=boost::mpl::integral_c<int,22>
1> ]
1>c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative
integral constant converted to unsigned type
1> c:\projects\boost
projects\mpl\tests\test_multi_precision.cpp(44) : see reference to class
template instantiation 'boost::mpl::print<T>' being compiled
1> with
1> [
1>
T=boost::mpl::l_item<boost::mpl::long_<3>,boost::mpl::integral_c<int,33>,boost::mpl::list2_c<int,22,64>>
1> ]
}}}
What I hope to see for the third test is:
{{{
T=boost::mpl::list_c<int,33, 22,64>
}}}
If I use
{{{
print<
push_front<
list_c<int,
22,
64
>,
33
>::type
> x5;
}}}
But this fails to compile at all.
To me, the list_c implementation is misconceived. Maybe the following
should result
{{{
print<
list_c<int,
22,
64
>::type // note the ::type to make it a metafunction
> x8;
}}}
to return
{{{
T=boost::mpl::list<boost::mpl::integral_c<int,
22>,boost::mpl::integral_c<int, 64> >
}}}
Of course the same observations would apply to vector_c, etc.
Robert Ramey
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6961> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC