Boost logo

Boost :

Subject: Re: [boost]  [chrono] Compiler errors for mpl/abs.hpp
From: Vicente BOTET (vicente.botet_at_[hidden])
Date: 2011-04-15 02:06:20


Hi,

since Boost.Chrono was accepted I have moved to the trunk and the release branch. There are a lot of file in the sandbox that have been changed since. In particular the error comes from some compilers don't supporting nested value arithmetic in templates. To workaround this the trunk contain instead

template<>
struct abs_impl
{
#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
template< typename N > struct apply
: aux::abs_wknd< typename N::value_type, N::value >
#else
template< typename N > struct apply
: integral_c< typename N::value_type, ((N::value < 0) ? (-N::value) : N::value ) >
#endif
{
};
};

For this reason a suggest you to move to the trunk or the release branch.

I will remove the Chrono sandbox as soon as the release 1.47 is out.

Best,
Vicente

Message du 15/04/11 00:29
> De : "lcaminiti"
> A : boost_at_[hidden]
> Copie à :
> Objet : [boost]  [chrono] Compiler errors for mpl/abs.hpp
>
> Hello all,
>
> I am trying to compile the example below on MSVC using Boost.Chrono
> (headers-only) from the sandbox but I am getting some compiler errors.
>
> What am I doing wrong?
>
> Thank you very much.
> --Lorenzo
>
> #define BOOST_CHRONO_INLINED
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
> int main(int argc, char* argv[]) {
> assert(argc == 2);
> unsigned long n = sqrt(double(atol(argv[1])));
>
> using boost::phoenix::ref;
> using boost::phoenix::arg_names::_1;
>
> double sum = 0.0;
> int factor = 1;
>
> std::vector v(n);
> std::fill(v.begin(), v.end(), 1.0);
>
> boost::chrono::duration sec;
> for (unsigned long i = 0; i < n; ++i) {
> boost::chrono::system_clock::time_point start =
> boost::chrono::system_clock::now();
> std::for_each(v.begin(), v.end(), (
> ref(sum) += factor * _1
> ));
> sec += boost::chrono::system_clock::now() - start;
> }
> std::cout << sec.count() << std::endl;
>
> assert(sum == n * n);
> return 0;
> }
>
> E:\sandbox\boost-sandbox-local\libs\local\example>cl /EHs /Ox /I..\..\..
> /I"c:\P
> rogram Files\boost\boost_1_46_1" /I..\..\..\..\boost-sandbox-chrono.x
> benchmark_
> boost_phoenix.cpp
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for
> 80x86
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> benchmark_boost_phoenix.cpp
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2143:
> syntax e
> rror : missing ',' before ')'
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(75) : see
> reference
> to class template instantiation 'boost::mpl::abs_impl::apply' being
> compiled
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2059:
> syntax e
> rror : ')'
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(74) : error C2143:
> syntax e
> rror : missing ';' before '{'
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(75) : error C2143:
> syntax e
> rror : missing ';' before '}'
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2143:
> syntax e
> rror : missing ';' before '}'
> ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : fatal error
> C1004: un
> expected end-of-file found
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/boost-chrono-Compiler-errors-for-mpl-abs-hpp-tp3450863p3450863.html
> Sent from the Boost - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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