mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-09 09:07:42 +00:00
Updates to rstl; rename some symbols; update CFLAGS
This commit is contained in:
@@ -6,13 +6,15 @@
|
||||
namespace rstl {
|
||||
template < typename T >
|
||||
inline void construct(void* dest, const T& src) {
|
||||
new(dest) T(src);
|
||||
new (dest) T(src);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
inline void destroy(T* in) {
|
||||
in->~T();
|
||||
}
|
||||
// template < typename T >
|
||||
// inline void destroy(const T* in) {}
|
||||
|
||||
template < typename Iter >
|
||||
inline void destroy(Iter begin, Iter end) {
|
||||
@@ -22,16 +24,47 @@ inline void destroy(Iter begin, Iter end) {
|
||||
++current;
|
||||
}
|
||||
}
|
||||
template < typename S >
|
||||
inline void destroy(S* begin, S* end) {
|
||||
S* current = begin;
|
||||
while (current != end) {
|
||||
destroy(current);
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename Iter, typename T >
|
||||
inline void uninitialized_copy(Iter begin, Iter end, T* in) {
|
||||
inline void uninitialized_copy(Iter begin, Iter end, T* out) {
|
||||
Iter current = begin;
|
||||
while (current != end) {
|
||||
current = *in;
|
||||
construct(out, *current);
|
||||
current.destroy();
|
||||
++out;
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename S, typename D >
|
||||
inline void uninitialized_copy(D* out, S* begin, S* end) {
|
||||
while (begin != end) {
|
||||
construct(out, *begin);
|
||||
++out;
|
||||
++begin;
|
||||
}
|
||||
// rstl::destroy(begin, end);
|
||||
}
|
||||
|
||||
// FIXME this is a hack around regalloc
|
||||
// need to figure out the proper types/positions for all of these funcs
|
||||
template < typename S, typename D >
|
||||
inline void uninitialized_copy_2(S* begin, D* out, S* end) {
|
||||
while (begin != end) {
|
||||
construct(out, *begin);
|
||||
++out;
|
||||
++begin;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename S, typename D >
|
||||
inline void uninitialized_copy_n(D* dest, S* src, size_t count) {
|
||||
for (size_t i = 0; i < count; ++dest, ++i, ++src) {
|
||||
|
||||
Reference in New Issue
Block a user