namespace octa -> namespace ostd

master
Daniel Kolesa 2015-07-13 20:07:14 +01:00
parent 33a1123970
commit 8ddbccc94f
27 changed files with 90 additions and 90 deletions

View File

@ -13,7 +13,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/initializer_list.hh" #include "octa/initializer_list.hh"
namespace octa { namespace ostd {
/* partitioning */ /* partitioning */
@ -153,7 +153,7 @@ template<typename R>
inline R min_element(R range) { inline R min_element(R range) {
R r = range; R r = range;
for (; !range.empty(); range.pop_front()) for (; !range.empty(); range.pop_front())
if (octa::min(r.front(), range.front()) == range.front()) if (ostd::min(r.front(), range.front()) == range.front())
r = range; r = range;
return r; return r;
} }
@ -161,7 +161,7 @@ template<typename R, typename C>
inline R min_element(R range, C compare) { inline R min_element(R range, C compare) {
R r = range; R r = range;
for (; !range.empty(); range.pop_front()) for (; !range.empty(); range.pop_front())
if (octa::min(r.front(), range.front(), compare) == range.front()) if (ostd::min(r.front(), range.front(), compare) == range.front())
r = range; r = range;
return r; return r;
} }
@ -170,7 +170,7 @@ template<typename R>
inline R max_element(R range) { inline R max_element(R range) {
R r = range; R r = range;
for (; !range.empty(); range.pop_front()) for (; !range.empty(); range.pop_front())
if (octa::max(r.front(), range.front()) == range.front()) if (ostd::max(r.front(), range.front()) == range.front())
r = range; r = range;
return r; return r;
} }
@ -178,40 +178,40 @@ template<typename R, typename C>
inline R max_element(R range, C compare) { inline R max_element(R range, C compare) {
R r = range; R r = range;
for (; !range.empty(); range.pop_front()) for (; !range.empty(); range.pop_front())
if (octa::max(r.front(), range.front(), compare) == range.front()) if (ostd::max(r.front(), range.front(), compare) == range.front())
r = range; r = range;
return r; return r;
} }
template<typename T> template<typename T>
inline T min(std::initializer_list<T> il) { inline T min(std::initializer_list<T> il) {
return octa::min_element(octa::iter(il)).front(); return ostd::min_element(ostd::iter(il)).front();
} }
template<typename T, typename C> template<typename T, typename C>
inline T min(std::initializer_list<T> il, C compare) { inline T min(std::initializer_list<T> il, C compare) {
return octa::min_element(octa::iter(il), compare).front(); return ostd::min_element(ostd::iter(il), compare).front();
} }
template<typename T> template<typename T>
inline T max(std::initializer_list<T> il) { inline T max(std::initializer_list<T> il) {
return octa::max_element(octa::iter(il)).front(); return ostd::max_element(ostd::iter(il)).front();
} }
template<typename T, typename C> template<typename T, typename C>
inline T max(std::initializer_list<T> il, C compare) { inline T max(std::initializer_list<T> il, C compare) {
return octa::max_element(octa::iter(il), compare).front(); return ostd::max_element(ostd::iter(il), compare).front();
} }
/* clamp */ /* clamp */
template<typename T, typename U> template<typename T, typename U>
inline T clamp(const T &v, const U &lo, const U &hi) { inline T clamp(const T &v, const U &lo, const U &hi) {
return octa::max(T(lo), octa::min(v, T(hi))); return ostd::max(T(lo), ostd::min(v, T(hi)));
} }
template<typename T, typename U, typename C> template<typename T, typename U, typename C>
inline T clamp(const T &v, const U &lo, const U &hi, C compare) { inline T clamp(const T &v, const U &lo, const U &hi, C compare) {
return octa::max(T(lo), octa::min(v, T(hi), compare), compare); return ostd::max(T(lo), ostd::min(v, T(hi), compare), compare);
} }
/* lexicographical compare */ /* lexicographical compare */
@ -396,7 +396,7 @@ Pair<R1, R2> swap_ranges(R1 range1, R2 range2) {
range1.pop_front(); range1.pop_front();
range2.pop_front(); range2.pop_front();
} }
return octa::make_pair(range1, range2); return ostd::make_pair(range1, range2);
} }
template<typename R, typename T> template<typename R, typename T>
@ -590,6 +590,6 @@ FilterRange<R, detail::FilterPred<R, P>> filter(R range, P pred) {
return FilterRange<R, P>(range, pred); return FilterRange<R, P>(range, pred);
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -13,11 +13,11 @@
#include "octa/string.hh" #include "octa/string.hh"
#include "octa/internal/tuple.hh" #include "octa/internal/tuple.hh"
namespace octa { namespace ostd {
template<typename T, Size N> template<typename T, Size N>
struct Array { struct Array {
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Value = T; using Value = T;
using Reference = T &; using Reference = T &;
@ -70,7 +70,7 @@ struct Array {
} }
void swap(Array &v) { void swap(Array &v) {
octa::swap_ranges(iter(), v.iter()); ostd::swap_ranges(iter(), v.iter());
} }
T p_buf[(N > 0) ? N : 1]; T p_buf[(N > 0) ? N : 1];
@ -129,6 +129,6 @@ inline bool operator>=(const Array<T, N> &x, const Array<T, N> &y) {
return !(x < y); return !(x < y);
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -12,7 +12,7 @@
#include "octa/types.hh" #include "octa/types.hh"
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
namespace octa { namespace ostd {
enum class MemoryOrder { enum class MemoryOrder {
relaxed = 0, relaxed = 0,

View File

@ -16,7 +16,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/internal/tuple.hh" #include "octa/internal/tuple.hh"
namespace octa { namespace ostd {
enum FormatFlags { enum FormatFlags {
FMT_FLAG_DASH = 1 << 0, FMT_FLAG_DASH = 1 << 0,
@ -519,7 +519,7 @@ namespace detail {
const T &val, const T &val,
EnableIf<FmtRangeTest<T>::value, bool> EnableIf<FmtRangeTest<T>::value, bool>
= true) { = true) {
auto range = octa::iter(val); auto range = ostd::iter(val);
if (range.empty()) return 0; if (range.empty()) return 0;
Ptrdiff ret = 0; Ptrdiff ret = 0;
Size fmtn = 0; Size fmtn = 0;
@ -553,7 +553,7 @@ namespace detail {
} }
template<typename T> template<typename T>
static True test_fmt_tostr(decltype(octa::to_string(declval<T>())) *); static True test_fmt_tostr(decltype(ostd::to_string(declval<T>())) *);
template<typename> static False test_fmt_tostr(...); template<typename> static False test_fmt_tostr(...);
template<typename T> template<typename T>
@ -776,7 +776,7 @@ namespace detail {
assert(false && "custom objects need '%s' format"); assert(false && "custom objects need '%s' format");
return -1; return -1;
} }
return write(writer, false, octa::to_string(val)); return write(writer, false, ostd::to_string(val));
} }
/* custom format case */ /* custom format case */
@ -938,6 +938,6 @@ Ptrdiff format(R &&writer, const AnyString<AL> &fmt, const A &...args) {
return format(writer, fmtn, fmt.data(), args...); return format(writer, fmtn, fmt.data(), args...);
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -14,7 +14,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
namespace octa { namespace ostd {
/* basic function objects */ /* basic function objects */
@ -797,7 +797,7 @@ struct Function<R(Args...)>: detail::FunctionBase<R, Args...> {
f.p_stor.manager->call_move_and_destroyf(tmp, move(f.p_stor)); f.p_stor.manager->call_move_and_destroyf(tmp, move(f.p_stor));
p_stor.manager->call_move_and_destroyf(f.p_stor, move(p_stor)); p_stor.manager->call_move_and_destroyf(f.p_stor, move(p_stor));
tmp.manager->call_move_and_destroyf(p_stor, move(tmp)); tmp.manager->call_move_and_destroyf(p_stor, move(tmp));
octa::swap(p_call, f.p_call); ostd::swap(p_call, f.p_call);
} }
operator bool() const { return p_call != nullptr; } operator bool() const { return p_call != nullptr; }
@ -906,6 +906,6 @@ namespace detail {
template<typename F> using FunctionMakeDefaultConstructible template<typename F> using FunctionMakeDefaultConstructible
= typename detail::DcFuncType<F>::Type; = typename detail::DcFuncType<F>::Type;
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -17,13 +17,13 @@ namespace std {
template<typename T> template<typename T>
class initializer_list { class initializer_list {
const T *p_buf; const T *p_buf;
octa::Size p_len; ostd::Size p_len;
constexpr initializer_list(const T *v, octa::Size n): p_buf(v), p_len(n) {} constexpr initializer_list(const T *v, ostd::Size n): p_buf(v), p_len(n) {}
public: public:
constexpr initializer_list(): p_buf(nullptr), p_len(0) {} constexpr initializer_list(): p_buf(nullptr), p_len(0) {}
constexpr octa::Size size() const { return p_len; } constexpr ostd::Size size() const { return p_len; }
constexpr const T *begin() const { return p_buf; } constexpr const T *begin() const { return p_buf; }
constexpr const T *end() const { return p_buf + p_len; } constexpr const T *end() const { return p_buf + p_len; }
@ -34,7 +34,7 @@ public:
#include <initializer_list> #include <initializer_list>
#endif #endif
namespace octa { namespace ostd {
template<typename T> using InitializerList = std::initializer_list<T>; template<typename T> using InitializerList = std::initializer_list<T>;

View File

@ -14,7 +14,7 @@
#include "octa/range.hh" #include "octa/range.hh"
#include "octa/initializer_list.hh" #include "octa/initializer_list.hh"
namespace octa { namespace ostd {
namespace detail { namespace detail {
template<typename T> template<typename T>
@ -618,6 +618,6 @@ public:
}; };
} /* namespace detail */ } /* namespace detail */
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -10,7 +10,7 @@
#include "octa/types.hh" #include "octa/types.hh"
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
namespace octa { namespace ostd {
template<typename ...A> class Tuple; template<typename ...A> class Tuple;
template<typename T, typename U> struct Pair; template<typename T, typename U> struct Pair;
@ -276,6 +276,6 @@ namespace detail {
> {}; > {};
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -13,7 +13,7 @@
#include "octa/stream.hh" #include "octa/stream.hh"
#include "octa/format.hh" #include "octa/format.hh"
namespace octa { namespace ostd {
enum class StreamMode { enum class StreamMode {
read, write, append, read, write, append,
@ -125,8 +125,8 @@ struct FileStream: Stream {
} }
void swap(FileStream &s) { void swap(FileStream &s) {
octa::swap(p_f, s.p_f); ostd::swap(p_f, s.p_f);
octa::swap(p_owned, s.p_owned); ostd::swap(p_owned, s.p_owned);
} }
FILE *get_file() { return p_f; } FILE *get_file() { return p_f; }
@ -153,7 +153,7 @@ inline void write(const AnyString<A> &s) {
template<typename T> template<typename T>
inline void write(const T &v) { inline void write(const T &v) {
write(octa::to_string(v)); write(ostd::to_string(v));
} }
template<typename T, typename ...A> template<typename T, typename ...A>
@ -175,7 +175,7 @@ inline void writeln(const AnyString<A> &s) {
template<typename T> template<typename T>
inline void writeln(const T &v) { inline void writeln(const T &v) {
writeln(octa::to_string(v)); writeln(ostd::to_string(v));
} }
template<typename T, typename ...A> template<typename T, typename ...A>
@ -231,6 +231,6 @@ inline void writefln(const AnyString<AL> &fmt,
putc('\n', ::stdout); putc('\n', ::stdout);
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -14,7 +14,7 @@
#include "octa/internal/hashtable.hh" #include "octa/internal/hashtable.hh"
namespace octa { namespace ostd {
namespace detail { namespace detail {
template<typename K, typename T, typename A> struct MapBase { template<typename K, typename T, typename A> struct MapBase {
@ -51,7 +51,7 @@ namespace detail {
public: public:
using Key = K; using Key = K;
using Mapped = T; using Mapped = T;
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Hasher = H; using Hasher = H;
using KeyEqual = C; using KeyEqual = C;
@ -177,6 +177,6 @@ template<
typename A = Allocator<Pair<const K, T>> typename A = Allocator<Pair<const K, T>>
> using Multimap = detail::MapImpl<K, T, H, C, A, true>; > using Multimap = detail::MapImpl<K, T, H, C, A, true>;
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -13,7 +13,7 @@
#include "octa/initializer_list.hh" #include "octa/initializer_list.hh"
#include "octa/functional.hh" #include "octa/functional.hh"
namespace octa { namespace ostd {
struct InPlace {}; struct InPlace {};
constexpr InPlace in_place = InPlace(); constexpr InPlace in_place = InPlace();
@ -254,7 +254,7 @@ public:
} }
Size to_hash() const { Size to_hash() const {
return this->p_engaged ? octa::ToHash<T>()(this->p_value) : 0; return this->p_engaged ? ostd::ToHash<T>()(this->p_value) : 0;
} }
}; };
@ -421,6 +421,6 @@ inline constexpr Maybe<Decay<T>> make_maybe(T &&v) {
return Maybe<Decay<T>>(forward<T>(v)); return Maybe<Decay<T>>(forward<T>(v));
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -12,7 +12,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
namespace octa { namespace ostd {
/* address of */ /* address of */
template<typename T> constexpr T *address_of(T &v) { template<typename T> constexpr T *address_of(T &v) {
@ -529,7 +529,7 @@ template<> struct Allocator<const void> {
}; };
template<typename T> struct Allocator { template<typename T> struct Allocator {
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Value = T; using Value = T;
using Reference = T &; using Reference = T &;
@ -566,7 +566,7 @@ template<typename T> struct Allocator {
}; };
template<typename T> struct Allocator<const T> { template<typename T> struct Allocator<const T> {
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Value = const T; using Value = const T;
using Reference = const T &; using Reference = const T &;
@ -1113,6 +1113,6 @@ struct UsesAllocatorConstructor: IntegralConstant<int,
detail::UsesAllocCtor<T, A, Args...>::value detail::UsesAllocCtor<T, A, Args...>::value
> {}; > {};
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -9,8 +9,8 @@
#ifndef OCTA_ALLOW_CXXSTD #ifndef OCTA_ALLOW_CXXSTD
#include "octa/types.hh" #include "octa/types.hh"
inline void *operator new (octa::Size, void *p) { return p; } inline void *operator new (ostd::Size, void *p) { return p; }
inline void *operator new [](octa::Size, void *p) { return p; } inline void *operator new [](ostd::Size, void *p) { return p; }
inline void operator delete (void *, void *) {} inline void operator delete (void *, void *) {}
inline void operator delete[](void *, void *) {} inline void operator delete[](void *, void *) {}
#else #else

View File

@ -71,7 +71,7 @@
# endif # endif
#endif #endif
namespace octa { namespace ostd {
#if defined(OCTA_TOOLCHAIN_GNU) #if defined(OCTA_TOOLCHAIN_GNU)

View File

@ -14,7 +14,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
namespace octa { namespace ostd {
struct InputRangeTag {}; struct InputRangeTag {};
struct OutputRangeTag {}; struct OutputRangeTag {};
@ -1182,6 +1182,6 @@ AppenderRange<T> appender(T &&v) {
// range of // range of
template<typename T> using RangeOf = decltype(iter(declval<T>())); template<typename T> using RangeOf = decltype(iter(declval<T>()));
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -14,7 +14,7 @@
#include "octa/internal/hashtable.hh" #include "octa/internal/hashtable.hh"
namespace octa { namespace ostd {
namespace detail { namespace detail {
template<typename T, typename A> struct SetBase { template<typename T, typename A> struct SetBase {
@ -40,7 +40,7 @@ namespace detail {
public: public:
using Key = T; using Key = T;
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Hasher = H; using Hasher = H;
using KeyEqual = C; using KeyEqual = C;
@ -148,6 +148,6 @@ template<
typename A = Allocator<T> typename A = Allocator<T>
> using Multiset = detail::SetImpl<T, H, C, A, true>; > using Multiset = detail::SetImpl<T, H, C, A, true>;
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -16,7 +16,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/format.hh" #include "octa/format.hh"
namespace octa { namespace ostd {
#ifndef OCTA_PLATFORM_WIN32 #ifndef OCTA_PLATFORM_WIN32
using StreamOffset = off_t; using StreamOffset = off_t;

View File

@ -13,7 +13,7 @@
#include "octa/range.hh" #include "octa/range.hh"
#include "octa/vector.hh" #include "octa/vector.hh"
namespace octa { namespace ostd {
static constexpr Size npos = -1; static constexpr Size npos = -1;
template<typename T, typename A = Allocator<T>> class StringBase; template<typename T, typename A = Allocator<T>> class StringBase;
@ -144,7 +144,7 @@ template<typename T, typename A>
class StringBase { class StringBase {
using StrPair = detail::CompressedPair<AllocatorPointer<A>, A>; using StrPair = detail::CompressedPair<AllocatorPointer<A>, A>;
octa::Size p_len, p_cap; ostd::Size p_len, p_cap;
StrPair p_buf; StrPair p_buf;
template<typename R> template<typename R>
@ -178,7 +178,7 @@ class StringBase {
} }
public: public:
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Value = T; using Value = T;
using Reference = T &; using Reference = T &;
@ -587,7 +587,7 @@ template<typename A, typename T, typename F, typename S = const char *>
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v, const S &sep, AnyString<A> concat(AllocatorArg, const A &alloc, const T &v, const S &sep,
F func) { F func) {
AnyString<A> ret(alloc); AnyString<A> ret(alloc);
auto range = octa::iter(v); auto range = ostd::iter(v);
if (range.empty()) return ret; if (range.empty()) return ret;
for (;;) { for (;;) {
ret += func(range.front()); ret += func(range.front());
@ -602,7 +602,7 @@ template<typename A, typename T, typename S = const char *>
AnyString<A> concat(AllocatorArg, const A &alloc, const T &v, AnyString<A> concat(AllocatorArg, const A &alloc, const T &v,
const S &sep = " ") { const S &sep = " ") {
AnyString<A> ret(alloc); AnyString<A> ret(alloc);
auto range = octa::iter(v); auto range = ostd::iter(v);
if (range.empty()) return ret; if (range.empty()) return ret;
for (;;) { for (;;) {
ret += range.front(); ret += range.front();
@ -626,23 +626,23 @@ String concat(const T &v, const S &sep = " ") {
template<typename A, typename T, typename F, typename S = const char *> template<typename A, typename T, typename F, typename S = const char *>
AnyString<A> concat(AllocatorArg, const A &alloc, AnyString<A> concat(AllocatorArg, const A &alloc,
std::initializer_list<T> v, const S &sep, F func) { std::initializer_list<T> v, const S &sep, F func) {
return concat(allocator_arg, alloc, octa::iter(v), sep, func); return concat(allocator_arg, alloc, ostd::iter(v), sep, func);
} }
template<typename A, typename T, typename S = const char *> template<typename A, typename T, typename S = const char *>
AnyString<A> concat(AllocatorArg, const A &alloc, AnyString<A> concat(AllocatorArg, const A &alloc,
std::initializer_list<T> v, const S &sep = " ") { std::initializer_list<T> v, const S &sep = " ") {
return concat(allocator_arg, alloc, octa::iter(v), sep); return concat(allocator_arg, alloc, ostd::iter(v), sep);
} }
template<typename T, typename F, typename S = const char *> template<typename T, typename F, typename S = const char *>
String concat(std::initializer_list<T> v, const S &sep, F func) { String concat(std::initializer_list<T> v, const S &sep, F func) {
return concat(octa::iter(v), sep, func); return concat(ostd::iter(v), sep, func);
} }
template<typename T, typename S = const char *> template<typename T, typename S = const char *>
String concat(std::initializer_list<T> v, const S &sep = " ") { String concat(std::initializer_list<T> v, const S &sep = " ") {
return concat(octa::iter(v), sep); return concat(ostd::iter(v), sep);
} }
namespace detail { namespace detail {
@ -656,7 +656,7 @@ namespace detail {
using ToStringTest = decltype(test_tostring<T>(0)); using ToStringTest = decltype(test_tostring<T>(0));
template<typename T> template<typename T>
True test_iterable(decltype(octa::iter(declval<T>())) *); True test_iterable(decltype(ostd::iter(declval<T>())) *);
template<typename> static False test_iterable(...); template<typename> static False test_iterable(...);
template<typename T> template<typename T>
@ -673,9 +673,9 @@ struct ToString<T, EnableIf<detail::IterableTest<T>::value>> {
String operator()(const T &v) const { String operator()(const T &v) const {
String ret("{"); String ret("{");
ret += concat(octa::iter(v), ", ", ToString< ret += concat(ostd::iter(v), ", ", ToString<
RemoveConst<RemoveReference< RemoveConst<RemoveReference<
RangeReference<decltype(octa::iter(v))> RangeReference<decltype(ostd::iter(v))>
>> >>
>()); >());
ret += "}"; ret += "}";
@ -821,6 +821,6 @@ String to_string(std::initializer_list<T> init) {
return to_string(iter(init)); return to_string(iter(init));
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -13,7 +13,7 @@
#include "octa/memory.hh" #include "octa/memory.hh"
#include "octa/utility.hh" #include "octa/utility.hh"
namespace octa { namespace ostd {
/* tuple size */ /* tuple size */
@ -556,6 +556,6 @@ inline bool operator>=(const Tuple<T...> &x, const Tuple<U...> &y) {
template<typename ...T, typename A> template<typename ...T, typename A>
struct UsesAllocator<Tuple<T...>, A>: True {}; struct UsesAllocator<Tuple<T...>, A>: True {};
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -10,7 +10,7 @@
#include "octa/types.hh" #include "octa/types.hh"
namespace octa { namespace ostd {
/* forward declarations */ /* forward declarations */
namespace detail { namespace detail {
@ -1235,6 +1235,6 @@ namespace detail {
template<typename T> template<typename T>
using UnderlyingType = typename detail::UnderlyingTypeBase<T>::Type; using UnderlyingType = typename detail::UnderlyingTypeBase<T>::Type;
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -9,7 +9,7 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
namespace octa { namespace ostd {
/* "builtin" types */ /* "builtin" types */

View File

@ -11,7 +11,7 @@
#include "octa/type_traits.hh" #include "octa/type_traits.hh"
#include "octa/internal/tuple.hh" #include "octa/internal/tuple.hh"
namespace octa { namespace ostd {
/* move */ /* move */
@ -81,7 +81,7 @@ template<typename T, Size N> inline void swap(T (&a)[N], T (&b)[N]) {
namespace detail { namespace detail {
template<typename T> inline void swap_adl(T &a, T &b) { template<typename T> inline void swap_adl(T &a, T &b) {
using octa::swap; using ostd::swap;
swap(a, b); swap(a, b);
} }
} }
@ -382,6 +382,6 @@ namespace detail {
}; };
} /* namespace detail */ } /* namespace detail */
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -16,13 +16,13 @@
#include "octa/initializer_list.hh" #include "octa/initializer_list.hh"
#include "octa/memory.hh" #include "octa/memory.hh"
namespace octa { namespace ostd {
template<typename T, typename A = Allocator<T>> template<typename T, typename A = Allocator<T>>
class Vector { class Vector {
using VecPair = detail::CompressedPair<AllocatorPointer<A>, A>; using VecPair = detail::CompressedPair<AllocatorPointer<A>, A>;
octa::Size p_len, p_cap; ostd::Size p_len, p_cap;
VecPair p_buf; VecPair p_buf;
void insert_base(Size idx, Size n) { void insert_base(Size idx, Size n) {
@ -74,7 +74,7 @@ class Vector {
} }
public: public:
using Size = octa::Size; using Size = ostd::Size;
using Difference = Ptrdiff; using Difference = Ptrdiff;
using Value = T; using Value = T;
using Reference = T &; using Reference = T &;
@ -382,7 +382,7 @@ public:
} }
Range insert(Size idx, InitializerList<T> il) { Range insert(Size idx, InitializerList<T> il) {
return insert_range(idx, octa::iter(il)); return insert_range(idx, ostd::iter(il));
} }
Range iter() { Range iter() {
@ -450,6 +450,6 @@ inline bool operator>=(const Vector<T, A> &x, const Vector<T, A> &y) {
return !(x < y); return !(x < y);
} }
} /* namespace octa */ } /* namespace ostd */
#endif #endif

View File

@ -7,13 +7,13 @@
#include "octa/types.hh" #include "octa/types.hh"
void *operator new(octa::Size size) { void *operator new(ostd::Size size) {
void *p = malloc(size); void *p = malloc(size);
if (!p) abort(); if (!p) abort();
return p; return p;
} }
void *operator new[](octa::Size size) { void *operator new[](ostd::Size size) {
void *p = malloc(size); void *p = malloc(size);
if (!p) abort(); if (!p) abort();
return p; return p;

View File

@ -3,7 +3,7 @@
#include "octa/array.hh" #include "octa/array.hh"
#include "octa/string.hh" #include "octa/string.hh"
using namespace octa; using namespace ostd;
int main() { int main() {
Array<int, 5> x = { 2, 4, 8, 16, 32 }; Array<int, 5> x = { 2, 4, 8, 16, 32 };

View File

@ -3,7 +3,7 @@
#include "octa/utility.hh" #include "octa/utility.hh"
#include "octa/string.hh" #include "octa/string.hh"
using namespace octa; using namespace ostd;
struct Foo { struct Foo {
int x; int x;

View File

@ -3,7 +3,7 @@
#include "octa/vector.hh" #include "octa/vector.hh"
#include "octa/string.hh" #include "octa/string.hh"
using namespace octa; using namespace ostd;
int main() { int main() {
Vector<int> x = { 5, 10, 15, 20 }; Vector<int> x = { 5, 10, 15, 20 };