Fusion 2. Vector Example

Hello, At the bottom of the page http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/... there is the following example: vector<int, float> v(12, 5.5f); std::cout << at<0>(v) << std::endl; std::cout << at<1>(v) << std::endl; The example as such does not compile, Shouldn't it be:std::cout << at_c<0>(v) << std::endl;orstd::cout << at<boost::mpl::int_<0> >(v) << std::endl;

John Christopher wrote:
Hello, At the bottom of the page http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/... there is the following example: vector<int, float> v(12, 5.5f); std::cout << at<0>(v) << std::endl; std::cout << at<1>(v) << std::endl; The example as such does not compile, Shouldn't it be:std::cout << at_c<0>(v) << std::endl;orstd::cout << at<boost::mpl::int_<0> >(v) << std::endl;
Yes, at_c is correct. Fixed in CVS. Thanks! Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

Joel, I was wondering if "at_c" is only a convenience version of "at" or there is a deeper difference? In other words, is std::cout << at_c<0>(v) << std::endl; fully equivalent to std::cout << at<boost::mpl::int_<0> >(v) << std::endl; Thanks for this very nice library JCR "Joel de Guzman" <joel@boost-consulting.com> wrote in message news:e3b90h$au5$1@sea.gmane.org...
John Christopher wrote:
Hello, At the bottom of the page http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/... there is the following example: vector<int, float> v(12, 5.5f); std::cout << at<0>(v) << std::endl; std::cout << at<1>(v) << std::endl; The example as such does not compile, Shouldn't it be:std::cout << at_c<0>(v) << std::endl;orstd::cout << at<boost::mpl::int_<0> >(v) << std::endl;
Yes, at_c is correct. Fixed in CVS. Thanks!
Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

John Christopher wrote:
Joel, I was wondering if "at_c" is only a convenience version of "at" or there is a deeper difference? In other words, is std::cout << at_c<0>(v) << std::endl; fully equivalent to std::cout << at<boost::mpl::int_<0> >(v) << std::endl;
Yes, they are fully equivalent. Yes, at_c is only a convenience version of at. at is more suitable for MPL style metaprogramming when the computation of the index is involved.
Thanks for this very nice library
Most welcome! :) Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (2)
-
Joel de Guzman
-
John Christopher