Subject: CGAL users discussion list
List archive
- From: Cody Rose <>
- To:
- Subject: Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE
- Date: Wed, 30 Jan 2013 11:22:40 -0800
On 1/30/2013 2:48 AM, Philipp Moeller wrote:
"Sebastien Loriot (GeometryFactory)"
<>
writes:
On 01/30/2013 11:39 AM, Philipp Moeller wrote:You can define it yourself, it is just not guaranteed to work for every
CodyI guess you meant you can't define BOOST_RESULT_OF_USE_DECLTYPE ?
Rose<>
writes:
Hello,You have to define BOOST_RESULT_OF_USE_DECLTYPE because your compiler
With CGAL 4.1 I am unable to use the Nef_polyhedron_3 package with
BOOST_RESULT_OF_USE_DECLTYPE defined. I am using:
does not implement a fully conforming decltype. (AFAIK, the only
compiler that currently does is clang 3.2).
library (as you can see here). This was even one of the fixes for using
Boost.Range with lambdas.
Yes, this is exactly what I was trying to do, as I demonstrated: get parts of Boost.Range to work with lambdas in MSVC 2010. That kind of thing is what the macro is for.
Yeah, I was hoping there would be a workaround either for my code or maybe even put into CGAL at some point. I can totally understand not wanting to work around a weird corner-case bug in a compiler that isn't even the latest version, though. Oh well! All it seems to really be affecting is boost::adaptors::transformed.CGAL 3.9 didn't use result_of. That's why you don't see the problem.
CGAL 4.1
the CORE numeric library, along with its dependencies (GMP etc)
Boost 1.47
Visual Studio 2010
The problem does *not* appear in CGAL 3.9.
The following code reproduces the problem for me:This is because MSVC decltype triggers instantiation prematurely.
// This is the problematic define.
#define BOOST_RESULT_OF_USE_DECLTYPE
#include<vector>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<CGAL/Cartesian.h>
#include<CGAL/CORE_Expr.h>
#include<CGAL/Nef_polyhedron_3.h>
typedef CORE::Expr NT;
typedef CGAL::Cartesian<NT> K;
typedef CGAL::Nef_polyhedron_3<K> nef_polyhedron_3;
int main() {
std::vector<int> a(0, 3);
a[0] = 1;
a[1] = 2;
a[3] = 3;
std::vector<int> b;
// With BOOST_RESULT_OF_USE_DECLTYPE defined, the following line
causes an error.
nef_polyhedron_3 foo;
// Without BOOST_RESULT_OF_USE_DECLTYPE defined, the followingThis is because built-in lambdas require a decltype based result_of.
line causes an error.
boost::copy(a | boost::adaptors::transformed([](int x) { return xIt would be nice if both worked together, even with a broken
* 2; }), std::back_inserter(b)); return 0; }
decltype. If I remember correctly there was a work-around involving two
Type_equality_wrappers when instantiating kernels.
Thanks,
Cody
- [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Cody Rose, 01/29/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Philipp Moeller, 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Sebastien Loriot (GeometryFactory), 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Philipp Moeller, 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Cody Rose, 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Philipp Moeller, 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Sebastien Loriot (GeometryFactory), 01/30/2013
- Re: [cgal-discuss] problem with BOOST_RESULT_OF_USE_DECLTYPE, Philipp Moeller, 01/30/2013
Archive powered by MHonArc 2.6.18.