Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polymesh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Philip Trettner
polymesh
Commits
0996e0ee
Commit
0996e0ee
authored
2 years ago
by
Philip Trettner
Browse files
Options
Downloads
Patches
Plain Diff
optional support for c++20
parent
98ad96fa
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/polymesh/cursors.hh
+11
-2
11 additions, 2 deletions
src/polymesh/cursors.hh
src/polymesh/iterators.hh
+3
-3
3 additions, 3 deletions
src/polymesh/iterators.hh
src/polymesh/macros.hh
+4
-0
4 additions, 0 deletions
src/polymesh/macros.hh
src/polymesh/tmp.hh
+6
-0
6 additions, 0 deletions
src/polymesh/tmp.hh
with
24 additions
and
5 deletions
src/polymesh/cursors.hh
+
11
−
2
View file @
0996e0ee
...
...
@@ -24,6 +24,10 @@ struct primitive_index
bool
is_invalid
()
const
{
return
value
<
0
;
}
static
const
index_t
invalid
;
#ifdef POLYMESH_CPP20
bool
operator
==
(
primitive_index
const
&
)
const
=
default
;
auto
operator
<=>
(
primitive_index
const
&
)
const
=
default
;
#else
bool
operator
<
(
index_t
const
&
rhs
)
const
{
return
value
<
rhs
.
value
;
}
bool
operator
<=
(
index_t
const
&
rhs
)
const
{
return
value
<=
rhs
.
value
;
}
bool
operator
>
(
index_t
const
&
rhs
)
const
{
return
value
>
rhs
.
value
;
}
...
...
@@ -32,6 +36,7 @@ struct primitive_index
bool
operator
!=
(
index_t
const
&
rhs
)
const
{
return
value
!=
rhs
.
value
;
}
bool
operator
==
(
handle_t
const
&
rhs
)
const
{
return
value
==
rhs
.
idx
.
value
;
}
bool
operator
!=
(
handle_t
const
&
rhs
)
const
{
return
value
!=
rhs
.
idx
.
value
;
}
#endif
explicit
operator
int
()
const
{
return
value
;
}
...
...
@@ -73,10 +78,14 @@ struct primitive_handle
primitive_handle
()
=
default
;
primitive_handle
(
Mesh
const
*
mesh
,
index_t
idx
)
:
mesh
(
mesh
),
idx
(
idx
)
{}
bool
operator
==
(
index_t
const
&
rhs
)
const
{
return
idx
==
rhs
;
}
bool
operator
!=
(
index_t
const
&
rhs
)
const
{
return
idx
!=
rhs
;
}
#ifdef POLYMESH_CPP20
bool
operator
==
(
primitive_handle
const
&
)
const
=
default
;
#else
bool
operator
==
(
handle_t
const
&
rhs
)
const
{
return
mesh
==
rhs
.
mesh
&&
idx
==
rhs
.
idx
;
}
bool
operator
!=
(
handle_t
const
&
rhs
)
const
{
return
mesh
!=
rhs
.
mesh
||
idx
!=
rhs
.
idx
;
}
#endif
bool
operator
==
(
index_t
const
&
rhs
)
const
{
return
idx
==
rhs
;
}
bool
operator
!=
(
index_t
const
&
rhs
)
const
{
return
idx
!=
rhs
;
}
explicit
operator
int
()
const
{
return
(
int
)
idx
;
}
operator
index_t
()
const
{
return
idx
;
}
...
...
This diff is collapsed.
Click to expand it.
src/polymesh/iterators.hh
+
3
−
3
View file @
0996e0ee
...
...
@@ -149,7 +149,7 @@ struct primitive_circulator : smart_iterator<this_t>
primitive_circulator
(
halfedge_handle
h
,
bool
at_begin
=
true
)
:
handle
(
h
),
end
(
h
),
at_begin
(
at_begin
)
{}
bool
is_valid
()
const
{
return
at_begin
||
handle
!=
end
;
}
bool
is_valid
()
const
{
return
at_begin
||
handle
.
idx
!=
end
;
}
};
struct
face_vertex_circulator
:
primitive_circulator
<
face_vertex_circulator
>
...
...
@@ -195,7 +195,7 @@ struct face_face_circulator : primitive_circulator<face_face_circulator>
do
// skip invalid faces
{
handle
=
handle
.
next
();
}
while
(
handle
!=
end
&&
handle
.
opposite_face
().
is_invalid
());
}
while
(
handle
.
idx
!=
end
&&
handle
.
opposite_face
().
is_invalid
());
at_begin
=
false
;
}
};
...
...
@@ -243,7 +243,7 @@ struct vertex_face_circulator : primitive_circulator<vertex_face_circulator>
do
// skip invalid faces
{
handle
=
handle
.
prev
().
opposite
();
}
while
(
handle
!=
end
&&
handle
.
face
().
is_invalid
());
}
while
(
handle
.
idx
!=
end
&&
handle
.
face
().
is_invalid
());
at_begin
=
false
;
}
};
...
...
This diff is collapsed.
Click to expand it.
src/polymesh/macros.hh
+
4
−
0
View file @
0996e0ee
...
...
@@ -17,6 +17,10 @@
#error "Unknown compiler"
#endif
#if __cplusplus >= 202002L
#define POLYMESH_CPP20
#endif
// =========
// compiler specific builtins
...
...
This diff is collapsed.
Click to expand it.
src/polymesh/tmp.hh
+
6
−
0
View file @
0996e0ee
...
...
@@ -3,6 +3,12 @@
#include
<cstddef>
#include
<utility>
#include
<polymesh/macros.hh>
#ifdef POLYMESH_CPP20
#include
<compare>
#endif
namespace
polymesh
{
// small template metaprogramming
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment