-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from gjbex/development
Development
- Loading branch information
Showing
5 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
project(algorithms LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMaKE_CXX_STANDARD_REQUIRED YES) | ||
set(CMAKE_CXX_EXTENSIONS NO) | ||
|
||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
|
||
add_executable(find_if.exe | ||
find_if.cpp) | ||
add_executable(permutations.exe | ||
permutations.cpp) | ||
add_executable(generate.exe | ||
generate.cpp) | ||
add_executable(for_each.exe | ||
for_each.cpp) | ||
add_executable(particle_sort.exe | ||
particle_sort.cpp) | ||
add_executable(count_clamp.exe | ||
count_clamp.cpp) | ||
add_executable(find_words.exe | ||
find_words.cpp) | ||
add_executable(zip_it.exe | ||
zip_it.cpp) | ||
add_executable(accumulate.exe | ||
accumulate.cpp) | ||
add_executable(distance.exe | ||
distance.cpp) | ||
add_executable(iota.exe | ||
iota.cpp) | ||
add_executable(transform.exe | ||
transform.cpp) | ||
add_executable(points.exe | ||
points.cpp) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <algorithm> | ||
#include <compare> | ||
#include <iostream> | ||
#include <vector> | ||
|
||
struct Point { | ||
double x, y; | ||
int id; | ||
auto operator<=>(const Point&) const = default; | ||
friend std::ostream& operator <<(std::ostream& out, const Point& p); | ||
}; | ||
|
||
std::ostream& operator <<(std::ostream& out, const Point& p) { | ||
return out << p.id << ": (" << p.x << ", " << p.y << ")"; | ||
} | ||
|
||
int main() { | ||
std::vector<Point> points; | ||
points.emplace_back(4.1, 5.2, 1); | ||
points.emplace_back(2.1, 7.2, 2); | ||
points.emplace_back(1.2, 9.2, 3); | ||
points.emplace_back(2.1, 3.2, 4); | ||
points.emplace_back(2.1, 3.2, 5); | ||
std::sort(points.begin(), points.end()); | ||
for (const auto& point: points) { | ||
std::cout << point << "\n"; | ||
} | ||
return 0; | ||
} |