Initial Course

This commit is contained in:
David Gil de Gómez Pérez
2026-08-11 17:40:36 +03:00
commit 9aed1d1d86
202 changed files with 3420 additions and 0 deletions
@@ -0,0 +1,20 @@
#include "auto_and_range_for.hpp"
namespace cpp11 {
auto double_values(const std::vector<int>& input) -> std::vector<int> {
(void)input;
return {};
}
auto join_with_auto(const std::vector<std::string>& parts) -> std::string {
(void)parts;
return {};
}
auto count_if_positive(const std::vector<int>& input) -> int {
(void)input;
return 0;
}
} // namespace cpp11
@@ -0,0 +1,24 @@
#include "constexpr_nullptr.hpp"
namespace cpp11 {
auto to_index(Color color) -> int {
switch (color) {
case Color::Red: return 0;
case Color::Green: return 1;
case Color::Blue: return 2;
}
return -1;
}
auto square(int value) -> int {
(void)value;
return 0;
}
auto find_null(int* ptr) -> int* {
(void)ptr;
return nullptr;
}
} // namespace cpp11
+24
View File
@@ -0,0 +1,24 @@
#include "move_semantics.hpp"
namespace cpp11 {
MovableBuffer::MovableBuffer(std::vector<int> data) : data_(std::move(data)) {}
MovableBuffer::MovableBuffer(MovableBuffer&& other) noexcept : data_(std::move(other.data_)) {}
auto MovableBuffer::operator=(MovableBuffer&& other) noexcept -> MovableBuffer& {
if (this != &other) {
data_ = std::move(other.data_);
}
return *this;
}
auto MovableBuffer::size() const -> std::size_t { return data_.size(); }
auto MovableBuffer::data() const -> const std::vector<int>& { return data_; }
auto consume(MovableBuffer buffer) -> std::size_t {
(void)buffer;
return 0;
}
} // namespace cpp11
+20
View File
@@ -0,0 +1,20 @@
#include "smart_pointers.hpp"
namespace cpp11 {
auto make_counter(int start) -> std::unique_ptr<int> {
(void)start;
return nullptr;
}
auto shared_total(const std::vector<std::shared_ptr<int>>& values) -> int {
(void)values;
return 0;
}
auto clone_unique(const std::unique_ptr<int>& value) -> std::unique_ptr<int> {
(void)value;
return nullptr;
}
} // namespace cpp11