-
Notifications
You must be signed in to change notification settings - Fork 0
/
astrochannel.hpp
66 lines (53 loc) · 2.27 KB
/
astrochannel.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <memory>
namespace astrochannel
{
template<class T, std::size_t D, class Alloc>
struct static_storage_allocator : std::allocator_traits<Alloc>
{
public:
typedef T value_type;
static const std::size_t internal_capacity = D;
std::size_t max_size() const
{
return D;
}
};
template<class T, std::size_t D, class A = std::allocator<T>> struct channelarray;
template<typename T, std::size_t D, class Alloc = std::allocator<T>>
struct static_channelarray : protected static_storage_allocator<T, D, Alloc>
{
public:
// typedef typename std::allocator_traits<Alloc>::value_type value_type;
// typedef typename std::allocator_traits<Alloc>::pointer pointer;
// typedef typename std::allocator_traits<Alloc>::const_pointer const_pointer;
// typedef typename std::allocator_traits<Alloc>::size_type size_type;
// typedef typename std::allocator_traits<Alloc>::difference_type difference_type;
// typedef typename std::allocator_traits<Alloc>::const_void_pointer const_void_pointer;
// typedef Alloc allocator_type;
};
template<typename T, class Alloc>
struct static_channelarray<T, 0, Alloc>
{
};
template<typename T, std::size_t D, class Alloc>
struct channelarray : static_channelarray<T, D, Alloc>
{
// using static_ = static_array<T, D, Alloc>;
// using static_::static_;
// using typename static_::value_type;
// channelarray(std::initializer_list<typename static_array<T, D>::value_type> ilv)
// : static_{static_array<T, D>(ilv.begin(), ilv.end())} {} // construct all with default constructor and copy to special memory at the end
int test;
channelarray(std::initializer_list<T> list) : test(1){}
channelarray() = default;
channelarray(channelarray const&) = delete;
channelarray(channelarray&& other) = delete;
};
template<typename T, class Alloc>
struct channelarray<T, 0, Alloc> : static_channelarray<T, 0, Alloc>
{
// using static_ = static_array<T, 0, Alloc>;
// using static_::static_;
channelarray() = default;
};
}