27 lines
619 B
C++
27 lines
619 B
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include <utility>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
namespace cpp11 {
|
||
|
|
|
||
|
|
class MovableBuffer {
|
||
|
|
public:
|
||
|
|
MovableBuffer() = default;
|
||
|
|
explicit MovableBuffer(std::vector<int> data);
|
||
|
|
MovableBuffer(const MovableBuffer&) = delete;
|
||
|
|
MovableBuffer(MovableBuffer&& other) noexcept;
|
||
|
|
auto operator=(MovableBuffer&& other) noexcept -> MovableBuffer&;
|
||
|
|
|
||
|
|
[[nodiscard]] auto size() const -> std::size_t;
|
||
|
|
[[nodiscard]] auto data() const -> const std::vector<int>&;
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::vector<int> data_;
|
||
|
|
};
|
||
|
|
|
||
|
|
[[nodiscard]] auto consume(MovableBuffer buffer) -> std::size_t;
|
||
|
|
|
||
|
|
} // namespace cpp11
|