make template specialization more clear

v1
Brett 2024-02-14 15:25:18 -05:00
parent ea31d8f26c
commit 8e5b3ed284
1 changed files with 15 additions and 22 deletions

View File

@ -80,6 +80,9 @@ namespace blt
private:
V* _v;
};
template<typename T, bool = std::is_copy_constructible_v<T> || std::is_copy_assignable_v<T>>
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<typename T, bool = std::is_copy_constructible_v<T> || std::is_copy_assignable_v<T>>
class scoped_buffer
template<typename T>
class scoped_buffer<T, true>
{
public:
using element_type = T;
@ -247,16 +250,6 @@ namespace blt
{
return buffer_;
}
// inline auto begin()
// {
// return ptr_iterator{buffer_};
// }
//
// inline ptr_iterator<T> end()
// {
// return ptr_iterator{&buffer_[size_]};
// }
constexpr iterator begin() noexcept
{
@ -304,6 +297,16 @@ namespace blt
}
};
template<typename T>
class scoped_buffer<T, false> : scoped_buffer<T, true>
{
using scoped_buffer<T, true>::scoped_buffer;
public:
scoped_buffer(const scoped_buffer& copy) = delete;
scoped_buffer operator=(scoped_buffer& copyAssignment) = delete;
};
template<typename T, size_t MAX_SIZE>
class static_vector
{
@ -388,16 +391,6 @@ namespace blt
}
};
template<typename T>
class scoped_buffer<T, false> : scoped_buffer<T, true>
{
using scoped_buffer<T, true>::scoped_buffer;
public:
scoped_buffer(const scoped_buffer& copy) = delete;
scoped_buffer operator=(scoped_buffer& copyAssignment) = delete;
};
template<typename T>
struct nullptr_initializer
{