Initial Course
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <expected>
|
||||
#include <string>
|
||||
|
||||
namespace cpp23 {
|
||||
|
||||
enum class ParseError { EmptyInput, InvalidNumber };
|
||||
|
||||
[[nodiscard]] auto parse_int(const std::string& text) -> std::expected<int, ParseError>;
|
||||
[[nodiscard]] auto safe_sqrt(int value) -> std::expected<double, std::string>;
|
||||
[[nodiscard]] auto chain_parse_and_double(const std::string& text) -> std::expected<int, ParseError>;
|
||||
|
||||
} // namespace cpp23
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <mdspan>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace cpp23 {
|
||||
|
||||
[[nodiscard]] auto make_row_major_matrix(int rows, int cols, int fill) -> std::vector<int>;
|
||||
[[nodiscard]] auto matrix_element(std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>> matrix,
|
||||
int row, int col) -> int;
|
||||
[[nodiscard]] auto row_sums(std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>> matrix)
|
||||
-> std::vector<int>;
|
||||
|
||||
} // namespace cpp23
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cpp23 {
|
||||
|
||||
[[nodiscard]] auto format_greeting(const std::string& name, int score) -> std::string;
|
||||
[[nodiscard]] auto format_table_row(const std::vector<std::string>& columns) -> std::string;
|
||||
[[nodiscard]] auto format_hex(std::uint32_t value) -> std::string;
|
||||
|
||||
} // namespace cpp23
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cpp23 {
|
||||
|
||||
[[nodiscard]] auto zip_sum(const std::vector<int>& a, const std::vector<int>& b) -> std::vector<int>;
|
||||
[[nodiscard]] auto chunk_strings(const std::vector<std::string>& words, std::size_t chunk_size)
|
||||
-> std::vector<std::vector<std::string>>;
|
||||
[[nodiscard]] auto adjacent_differences(const std::vector<int>& data) -> std::vector<int>;
|
||||
|
||||
} // namespace cpp23
|
||||
Reference in New Issue
Block a user