[mpl] at<> example bug?

Looks like the example found here: http://www.boost.org/doc/libs/1_54_0/libs/mpl/doc/refmanual/at.html is buggy: BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 ); It should be: BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::type::value), ==, 10 ); Mostafa

On 06/08/13 01:52, Mostafa wrote:
Looks like the example found here: http://www.boost.org/doc/libs/1_54_0/libs/mpl/doc/refmanual/at.html is buggy:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 );
It should be:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::type::value), ==, 10 );
Both should work.

AMDG On 08/06/2013 12:47 PM, Mathias Gaunard wrote:
On 06/08/13 01:52, Mostafa wrote:
Looks like the example found here: http://www.boost.org/doc/libs/1_54_0/libs/mpl/doc/refmanual/at.html is buggy:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 );
It should be:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::type::value), ==, 10 );
Both should work.
That's only for arithmetic functions. In Christ, Steven Watanabe

On Tue, 06 Aug 2013 14:12:09 -0700, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
On 08/06/2013 12:47 PM, Mathias Gaunard wrote:
On 06/08/13 01:52, Mostafa wrote:
Looks like the example found here: http://www.boost.org/doc/libs/1_54_0/libs/mpl/doc/refmanual/at.html is buggy:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 );
It should be:
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::type::value), ==, 10 );
Both should work.
That's only for arithmetic functions.
Steven, sorry I don't understand what you're trying to say. Mathias, on Win7/Cygwin g++ 4.7.3 I get the following results, which contradict the example on the boost web page: #include <boost/mpl/range_c.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/int.hpp> #include <boost/mpl/assert.hpp> int main() { namespace bm = boost::mpl; typedef bm::range_c<long,10,50> range; //Does not compile. //bm::at<range, bm::int_<0> >::value == 10; //Compiles. //bm::at<range, bm::int_<0> >::type::value == 10; using namespace boost::mpl; //Does not compile. //BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 ); //Compiles. BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::type::value), ==, 10 ); return 0; }
participants (3)
-
Mathias Gaunard
-
Mostafa
-
Steven Watanabe