Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
d5849416
Commit
d5849416
authored
Dec 14, 2015
by
Hans-Christian Ebke
Browse files
Added += operator to mesh iterators.
parent
b1bbd997
Changes
2
Show whitespace changes
Inline
Side-by-side
src/OpenMesh/Core/Mesh/Handles.hh
View file @
d5849416
...
...
@@ -98,6 +98,8 @@ public:
void
__increment
()
{
++
idx_
;
}
void
__decrement
()
{
--
idx_
;
}
void
__increment
(
int
amount
)
{
idx_
+=
amount
;
}
void
__decrement
(
int
amount
)
{
idx_
+=
amount
;
}
private:
...
...
src/OpenMesh/Core/Mesh/IteratorsT.hh
View file @
d5849416
...
...
@@ -170,6 +170,37 @@ class GenericIteratorT {
return
cpy
;
}
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY)
template
<
class
T
=
value_handle
>
auto
operator
+=
(
int
amount
)
->
typename
std
::
enable_if
<
sizeof
(
decltype
(
std
::
declval
<
T
>
().
__increment
(
amount
)))
>=
0
,
GenericIteratorT
&>::
type
{
static_assert
(
std
::
is_same
<
T
,
value_handle
>::
value
,
"Template parameter must not deviate from default."
);
if
(
skip_bits_
)
throw
std
::
logic_error
(
"Skipping iterators do not support "
"random access."
);
hnd_
.
__increment
(
amount
);
return
*
this
;
}
template
<
class
T
=
value_handle
>
auto
operator
+
(
int
rhs
)
->
typename
std
::
enable_if
<
sizeof
(
decltype
(
std
::
declval
<
T
>
().
__increment
(
rhs
),
void
(),
int
{}))
>=
0
,
GenericIteratorT
>::
type
{
static_assert
(
std
::
is_same
<
T
,
value_handle
>::
value
,
"Template parameter must not deviate from default."
);
if
(
skip_bits_
)
throw
std
::
logic_error
(
"Skipping iterators do not support "
"random access."
);
GenericIteratorT
result
=
*
this
;
result
.
hnd_
.
__increment
(
rhs
);
return
result
;
}
#endif
/// Standard pre-decrement operator
GenericIteratorT
&
operator
--
()
{
hnd_
.
__decrement
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment