Allow Data::FillWithZeroes on rvalue
This commit is contained in:
parent
30a1a3617e
commit
2bc3b641aa
@ -30,7 +30,8 @@ public:
|
||||
|
||||
size_t size() const;
|
||||
|
||||
Data &FillWithZeroes();
|
||||
Data &FillWithZeroes() &;
|
||||
Data &&FillWithZeroes() &&;
|
||||
|
||||
void StoreToFile(const boost::filesystem::path &filepath) const;
|
||||
static boost::optional<Data> LoadFromFile(const boost::filesystem::path &filepath);
|
||||
@ -113,9 +114,13 @@ inline size_t Data::size() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
inline Data &Data::FillWithZeroes() {
|
||||
std::memset(_data, 0, _size);
|
||||
return *this;
|
||||
inline Data &Data::FillWithZeroes() & {
|
||||
std::memset(_data, 0, _size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Data &&Data::FillWithZeroes() && {
|
||||
return std::move(FillWithZeroes());
|
||||
}
|
||||
|
||||
inline void Data::StoreToFile(const boost::filesystem::path &filepath) const {
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
Data ZEROES;
|
||||
|
||||
OnDiskBlockCreateSizeTest():
|
||||
block(OnDiskBlock::CreateOnDisk(dir.path(), key, std::move(Data(GetParam()).FillWithZeroes())).value()),
|
||||
block(OnDiskBlock::CreateOnDisk(dir.path(), key, Data(GetParam()).FillWithZeroes()).value()),
|
||||
ZEROES(block->size())
|
||||
{
|
||||
ZEROES.FillWithZeroes();
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
static Data CreateZeroes(unsigned int size) {
|
||||
return std::move(Data(size).FillWithZeroes());
|
||||
return Data(size).FillWithZeroes();
|
||||
}
|
||||
|
||||
static Data CreateData(unsigned int size, unsigned int seed = 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user