summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-02 11:14:40 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-02 11:14:40 -0400
commit87dbcb62ef00e6509d92ec46d9024e2d1c453df3 (patch)
tree69e576d03238265d76266831c25aacf3bcd2bae6
parentca7e0fb827f216d0d554e7477a5c61b5d827407c (diff)
TArray: Add `size_as()`
-rw-r--r--include/pso/TArray.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/pso/TArray.h b/include/pso/TArray.h
index 29dc01e..7f53785 100644
--- a/include/pso/TArray.h
+++ b/include/pso/TArray.h
@@ -41,6 +41,11 @@ public:
};
template<typename T2>
+ size_t size_as() {
+ return byte_size() / sizeof(T2);
+ };
+
+ template<typename T2>
TArray<T2, (n * sizeof(T))/sizeof(T2)> &to() {
typedef TArray<T2, sizeof(m_data)/sizeof(T2)> to_type;
return reinterpret_cast<to_type &>(*this);