From 8e5b3ed284d88882bdd519e2777e4cb38e16b844 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Wed, 14 Feb 2024 15:25:18 -0500 Subject: [PATCH] make template specialization more clear --- include/blt/std/memory.h | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/include/blt/std/memory.h b/include/blt/std/memory.h index a6436e9..e72b843 100755 --- a/include/blt/std/memory.h +++ b/include/blt/std/memory.h @@ -80,6 +80,9 @@ namespace blt private: V* _v; }; + + template || std::is_copy_assignable_v> + class scoped_buffer; /** * Creates an encapsulation of a T array which will be automatically deleted when this object goes out of scope. @@ -88,8 +91,8 @@ namespace blt * The operator * has been overloaded to return the internal buffer. * @tparam T type that is stored in buffer eg char */ - template || std::is_copy_assignable_v> - class scoped_buffer + template + class scoped_buffer { public: using element_type = T; @@ -247,16 +250,6 @@ namespace blt { return buffer_; } - -// inline auto begin() -// { -// return ptr_iterator{buffer_}; -// } -// -// inline ptr_iterator end() -// { -// return ptr_iterator{&buffer_[size_]}; -// } constexpr iterator begin() noexcept { @@ -304,6 +297,16 @@ namespace blt } }; + template + class scoped_buffer : scoped_buffer + { + using scoped_buffer::scoped_buffer; + public: + scoped_buffer(const scoped_buffer& copy) = delete; + + scoped_buffer operator=(scoped_buffer& copyAssignment) = delete; + }; + template class static_vector { @@ -388,16 +391,6 @@ namespace blt } }; - template - class scoped_buffer : scoped_buffer - { - using scoped_buffer::scoped_buffer; - public: - scoped_buffer(const scoped_buffer& copy) = delete; - - scoped_buffer operator=(scoped_buffer& copyAssignment) = delete; - }; - template struct nullptr_initializer {