Conversation
| } | ||
|
|
||
| } } | ||
|
|
There was a problem hiding this comment.
@mglisse Would you mind reviewing this file with the four overloads of CGAL::for_range_loop::make_range?
I am not sure but I think:
- The three overloads about
std::paircould be replaced by one taking its parameter by copy. - Maybe the fourth overload (generic) of
make_rangeis not optimal.
There was a problem hiding this comment.
The three overloads about std::pair could be replaced by one taking its parameter by copy.
Forgot to comment about this part but indeed, the last 2 std::pair overloads are redundant, the first one (const&) should suffice.
STL_Extension/include/CGAL/foreach.h
Outdated
|
|
||
| #define CGAL_FOREACH(A,B) for(A : CGAL::for_range_loop::make_range(B)) | ||
| #else | ||
| #include <CGAL/foreach.h> |
There was a problem hiding this comment.
Did you mean to include a boost header instead here?
There was a problem hiding this comment.
Right, I did not exclude the header from sed input files
STL_Extension/include/CGAL/foreach.h
Outdated
| #else | ||
| /// \ingroup PkgStlExtension | ||
| /// If the version of `boost` is at least 1.51 and the compiler used support range-based for loops | ||
| /// introduced with \cpp11, use it; otherwise fallback onto `CGAL_FOREACH`. |
|
The generic version is dangerous. If I have a function f that returns a vector (by value), CGAL_FOREACH(whatever,f()) will destruct the vector before even calling begin(). It would be safer to have |
|
Special handling for std::pair is a hack to delay the inevitable: stop using std::pair as a range. I can understand not being in a hurry to fix it though. |
What do you mean?
|
|
Try it on an example? |
|
Travis detected an error: |
6f5bdd0 to
53f0303
Compare
|
@mglisse I think my last commit fixes the issue you mentioned. Do you see a better solution? (I cannot remove the extra overloads for |
Yes.
Stop using std::pair as ranges so we don't need the make_range helper at all? Stop supporting C++03?
You mean removing the |
|
Here is the problematic call: |
|
Ah yes, of course, once you have a fully generic make_range overload, it is more specialized than the By the way, could we start replacing those std::make_pair with boost::make_iterator_range? These are the easy cases where the use of std::pair is not baked in the API. |
thanks 👍 |
|
conflicts |
…ST_FOREACH this is to work around a bug observed with MSVC 2015
9dccf63 to
07c3835
Compare
|
Rebased |
|
There is the following error reported by travis with gcc 4.8.4. |
Looks like a bug in gcc-4.8, it compiles fine with 4.9. |
|
Travis shows a compilation issue: https://travis-ci.org/CGAL/cgal/jobs/325369172#L1550 What is more, CGAL-4.12-Ic-134 seems rather red on older Windows, because of the lack of support of |
|
On my machine, // C++11 features supported by VC++ 14 update 3 (aka 2015)
//
#if (_MSC_FULL_VER < 190024210)
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
# define BOOST_NO_SFINAE_EXPR
# define BOOST_NO_CXX11_CONSTEXPR
#endifThat means that |
|
Should this PR be removed? |
|
well the issue is still here but I need to look again to see how to fix the remaining issues. |
|
No longer needed with the move to C++14 |
Introduces CGAL_FOREACH that uses c++11 range loop for if available or BOOST_FOREACH.
There is a tiny variation as
std::pair<T,T>is binded on the fly toIterator_range<T>.The files to be reviewed is
STL_Extension/include/CGAL/foreach.h.In passing 2bb0e40 and e34ca45 are bug-fixes not related to the change.
Fixes #2627
Replaces #2626