util/{Const,Writable}Buffer: add array constructor
This commit is contained in:
parent
61aca389c4
commit
9237f2a80c
@ -105,6 +105,13 @@ struct ConstBuffer {
|
||||
constexpr ConstBuffer(pointer_type _data, size_type _size)
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
/**
|
||||
* Convert array to ConstBuffer instance.
|
||||
*/
|
||||
template<size_type _size>
|
||||
constexpr ConstBuffer(const T (&_data)[_size])
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr static ConstBuffer Null() {
|
||||
return ConstBuffer(nullptr, 0);
|
||||
}
|
||||
|
@ -99,6 +99,13 @@ struct WritableBuffer {
|
||||
constexpr WritableBuffer(pointer_type _data, size_type _size)
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
/**
|
||||
* Convert array to WritableBuffer instance.
|
||||
*/
|
||||
template<size_type _size>
|
||||
constexpr WritableBuffer(T (&_data)[_size])
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr static WritableBuffer Null() {
|
||||
return { nullptr, 0 };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user