-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0657217
commit 031a5ba
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef PYTHONIC_ARRAY_ARRAY_COUNT_HPP | ||
#define PYTHONIC_ARRAY_ARRAY_COUNT_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/types/array.hpp" | ||
#include "pythonic/types/str.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
|
||
namespace array | ||
{ | ||
|
||
namespace array | ||
{ | ||
|
||
template <class T> | ||
types::none_type frombytes(types::array<T> &seq, types::str const &s) | ||
{ | ||
long size = seq.size(); | ||
seq.resize(size + s.size() / sizeof(T)); | ||
memcpy(&*seq.begin() + size, s.c_str(), s.size()); | ||
return {}; | ||
} | ||
|
||
} // namespace array | ||
} // namespace array | ||
PYTHONIC_NS_END | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMBYTES_HPP | ||
#define PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMBYTES_HPP | ||
|
||
#include "pythonic/include/types/array.hpp" | ||
#include "pythonic/include/types/str.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
|
||
namespace array | ||
{ | ||
|
||
namespace array | ||
{ | ||
|
||
template <class T> | ||
types::none_type frombytes(types::array<T> &seq, types::str const &); | ||
|
||
DEFINE_FUNCTOR(pythonic::array::array, frombytes); | ||
} // namespace array | ||
} // namespace array | ||
PYTHONIC_NS_END | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters