rust
Avril 4 years ago
parent 646482c555
commit 7e4e3f9867
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -3,10 +3,22 @@
#include <cow.hpp> #include <cow.hpp>
#include <utility> #include <utility>
XXX: Fuck this. Rewrite to use composition. Inheritance is a comlpete joke. template<typename T>
struct TypedCow : public _cow_util::Span<T> {
struct Fake;
private:
Cow base;
};
template<typename T> template<typename T>
struct TypedCow : private Cow, public _cow_util::Span<T> { struct TypedCow<T>::Fake : public {
51private:X'
Cow::Fake base; =\ }ªæ7+p
};
struct
#if 0
struct Fake; struct Fake;
friend class Fake; friend class Fake;
@ -16,8 +28,8 @@ struct TypedCow : private Cow, public _cow_util::Span<T> {
inline TypedCow(size_t sz) : Cow(sz * sizeof(T)) { init_copy(T()); } inline TypedCow(size_t sz) : Cow(sz * sizeof(T)) { init_copy(T()); }
inline TypedCow(size_t sz, const T& copy_from) : TypedCow(sz) { init_copy(copy_from); } inline TypedCow(size_t sz, const T& copy_from) : TypedCow(sz) { init_copy(copy_from); }
template<typename... Args> //template<typename... Args>
inline TypedCow(size_t sz, Args&&... args) : TypedCow(sz) { init_copy( T(std::forward<Args>(args)...) ); } //inline TypedCow(size_t sz, Args&&... args) : TypedCow(sz) { init_copy( T(std::forward<Args>(args)...) ); }
virtual inline ~TypedCow() { uninit(); } virtual inline ~TypedCow() { uninit(); }
@ -60,3 +72,4 @@ struct TypedCow<T>::Fake : private Cow::Fake, public _cow_util::Span<T> {
inline const void* area() const override { return Cow::Fake::area(); } inline const void* area() const override { return Cow::Fake::area(); }
inline void* area() override { return Cow::Fake::area(); } inline void* area() override { return Cow::Fake::area(); }
}; };
#endif

Loading…
Cancel
Save