make template specialization more clear
parent
ea31d8f26c
commit
8e5b3ed284
|
@ -81,6 +81,9 @@ namespace blt
|
|||
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.
|
||||
* This is a simple buffer meant to be used only inside of a function and not copied around.
|
||||
|
@ -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;
|
||||
|
@ -248,16 +251,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
|
||||
{
|
||||
return iterator{data()};
|
||||
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue