Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
polymesh
Commits
65025e1a
Commit
65025e1a
authored
Nov 04, 2020
by
Philip Trettner
Browse files
fixed span for ref types, copy_from with spans
parent
7679582c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/polymesh/attributes.hh
View file @
65025e1a
...
...
@@ -7,6 +7,7 @@
#include
<polymesh/cursors.hh>
#include
<polymesh/detail/unique_array.hh>
#include
<polymesh/ranges.hh>
#include
<polymesh/span.hh>
#include
<polymesh/tmp.hh>
#include
<polymesh/view.hh>
...
...
@@ -121,8 +122,8 @@ public:
// template <class ReadT, class WriteT>
// void view(ReadT&& r, WriteT&& w) && = delete;
/// copies as much data as possible from the given
vector
void
copy_from
(
s
td
::
vector
<
AttrT
>
const
&
data
);
/// copies as much data as possible from the given
range of data
void
copy_from
(
s
pan
<
AttrT
const
>
data
);
/// copies as much data as possible from the given array
void
copy_from
(
AttrT
const
*
data
,
int
cnt
);
/// copies as much data as possible from the given attribute
...
...
src/polymesh/impl/impl_attributes.hh
View file @
65025e1a
...
...
@@ -63,7 +63,7 @@ AttrT const& edge_attribute<AttrT>::operator()(halfedge_handle h) const
}
template
<
class
tag
,
class
AttrT
>
void
primitive_attribute
<
tag
,
AttrT
>::
copy_from
(
s
td
::
vector
<
AttrT
>
const
&
data
)
void
primitive_attribute
<
tag
,
AttrT
>::
copy_from
(
s
pan
<
AttrT
const
>
data
)
{
std
::
copy_n
(
data
.
data
(),
std
::
min
(
int
(
data
.
size
()),
this
->
size
()),
this
->
data
());
}
...
...
src/polymesh/tmp.hh
View file @
65025e1a
...
...
@@ -103,9 +103,11 @@ struct constant_rational
namespace
detail
{
template
<
class
Container
,
class
ElementT
>
auto
contiguous_range_test
(
Container
*
c
)
->
decltype
(
static_cast
<
ElementT
*>
(
c
->
data
()),
static_cast
<
size_t
>
(
c
->
size
()),
0
);
auto
contiguous_range_test
(
int
)
->
decltype
(
static_cast
<
ElementT
*>
(
std
::
declval
<
Container
>
().
data
()),
//
static_cast
<
size_t
>
(
std
::
declval
<
Container
>
().
size
()),
std
::
true_type
{});
template
<
class
Container
,
class
ElementT
>
char
contiguous_range_test
(
...
);
std
::
false_type
contiguous_range_test
(
char
);
template
<
class
Container
,
class
ElementT
,
class
=
void
>
struct
is_range_t
:
std
::
false_type
...
...
@@ -139,7 +141,7 @@ struct is_range_t<Container,
}
template
<
class
Container
,
class
ElementT
>
static
constexpr
bool
is_contiguous_range
=
sizeof
(
detail
::
contiguous_range_test
<
Container
,
ElementT
>
(
nullptr
))
==
sizeof
(
int
)
;
static
constexpr
bool
is_contiguous_range
=
decltype
(
detail
::
contiguous_range_test
<
Container
,
ElementT
>
(
0
))
::
value
;
template
<
class
Container
,
class
ElementT
>
static
constexpr
bool
is_range
=
detail
::
is_range_t
<
Container
,
ElementT
>::
value
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment