Skip to content

Commit

Permalink
array copy support
Browse files Browse the repository at this point in the history
Signed-off-by: i-curve <[email protected]>

#2
  • Loading branch information
i-curve committed Dec 18, 2023
1 parent 0399c28 commit 227eacf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ icurve::copy<AA, 3, BB, 2>(a, b);
c++ array
c style array
```c++
AA a[3];
BB b[2] = {BB(1, "first", true), BB(2, "second", false)};
icurve::copy(a, b);
```

c++ style array

```c++
std::array<AA,3> a;
std::array<BB, 2> b = {BB(1, "first", true), BB(2, "second", false)};
Expand Down
6 changes: 1 addition & 5 deletions include/icurve/copypp.hh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once
#if _MSC_VER && _MSVC_LANG < 201402L
#error "minimun c++ version is c++14."
#elif __cplusplus < 201402L
#if (_MSC_VER && _MSVC_LANG < 201402L) || __cplusplus < 201402L
#error "minimun c++ version is c++14."
#endif

Expand Down Expand Up @@ -78,8 +76,6 @@ void copy(std::span<D, L1> destination, std::span<S, L2> source) {
template <typename D, typename S>
void copy(std::vector<D> &destination, std::vector<S> &source) {
destination.clear();
if (source.empty())
return;
for (auto &item : source) {
D tmp;
copy(tmp, item);
Expand Down
4 changes: 1 addition & 3 deletions include/icurve/copypp_only.hh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once
#if _MSC_VER && _MSVC_LANG < 201402L
#error "minimun c++ version is c++14."
#elif __cplusplus < 201402L
#if (_MSC_VER && _MSVC_LANG < 201402L) || __cplusplus < 201402L
#error "minimun c++ version is c++14."
#endif

Expand Down

0 comments on commit 227eacf

Please sign in to comment.