Skip to content

Commit 67c9b67

Browse files

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

STL_Extension/include/CGAL/Iterator_project.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef CGAL_ITERATOR_PROJECT_H
2020
#define CGAL_ITERATOR_PROJECT_H 1
2121

22+
#include <CGAL/config.h>
2223
#include <iterator>
2324

2425
namespace CGAL {
@@ -136,8 +137,23 @@ class Iterator_project {
136137
Self tmp = *this;
137138
return tmp += -n;
138139
}
139-
difference_type operator-( const Self& i) const { return nt - i.nt; }
140-
reference operator[]( difference_type n) const {
140+
141+
#if defined(BOOST_MSVC)
142+
difference_type operator- (const Self& i) const {
143+
return nt - i.nt;
144+
}
145+
#else
146+
147+
template <typename It>
148+
std::enable_if_t<std::is_convertible_v<iterator_category, std::random_access_iterator_tag>
149+
&& std::is_convertible_v<const It&, const Self&>,
150+
difference_type>
151+
operator- (const It& i) const {
152+
return nt - i.nt;
153+
}
154+
#endif
155+
156+
reference operator[]( difference_type n) const {
141157
Self tmp = *this;
142158
tmp += n;
143159
return tmp.operator*();

0 commit comments

Comments
 (0)