forked from activeloopai/deeplake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstd_array_array.hpp
More file actions
63 lines (48 loc) · 1.18 KB
/
Copy pathstd_array_array.hpp
File metadata and controls
63 lines (48 loc) · 1.18 KB
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
#pragma once
#include "../dtype.hpp"
#include "../exceptions.hpp"
#include <array>
#include <cstdint>
#include <span>
namespace nd {
namespace impl {
template <uint32_t size>
icm::shape shape(size);
template <typename T, std::size_t size>
class std_array_array
{
public:
explicit std_array_array(std::array<T, size> value)
: value_(std::make_shared<std::array<T, size>>(value))
{}
std_array_array(const std_array_array&) = default;
std_array_array& operator=(const std_array_array&) = default;
std_array_array(std_array_array&&) noexcept = default;
std_array_array& operator=(std_array_array&&) noexcept = default;
~std_array_array() = default;
public:
enum dtype dtype() const
{
return dtype_enum_v<T>;
}
std::span<const uint8_t> data() const
{
return base::span_cast<const uint8_t>(std::span<const T>(value_->data(), size));
}
const auto& owner() const
{
return value_;
}
icm::shape shape() const
{
return ::nd::impl::shape<size>;
}
constexpr bool is_dynamic() const noexcept
{
return false;
}
private:
std::shared_ptr<std::array<T, size>> value_;
};
}
}