Initial Course
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cpp11 {
|
||||
|
||||
[[nodiscard]] auto double_values(const std::vector<int>& input) -> std::vector<int>;
|
||||
[[nodiscard]] auto join_with_auto(const std::vector<std::string>& parts) -> std::string;
|
||||
[[nodiscard]] auto count_if_positive(const std::vector<int>& input) -> int;
|
||||
|
||||
} // namespace cpp11
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace cpp11 {
|
||||
|
||||
enum class Color { Red, Green, Blue };
|
||||
|
||||
[[nodiscard]] auto to_index(Color color) -> int;
|
||||
[[nodiscard]] auto square(int value) -> int;
|
||||
[[nodiscard]] auto find_null(int* ptr) -> int*;
|
||||
|
||||
} // namespace cpp11
|
||||
@@ -0,0 +1,26 @@
|
||||
#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
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace cpp11 {
|
||||
|
||||
[[nodiscard]] auto make_counter(int start) -> std::unique_ptr<int>;
|
||||
[[nodiscard]] auto shared_total(const std::vector<std::shared_ptr<int>>& values) -> int;
|
||||
[[nodiscard]] auto clone_unique(const std::unique_ptr<int>& value) -> std::unique_ptr<int>;
|
||||
|
||||
} // namespace cpp11
|
||||
Reference in New Issue
Block a user