diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ed2f647..8603c7a 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,13 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing C++ ## -## This project can be built to debug and run all nested projects ## -## Or, any subdirectory with a project() statement can be selected ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing C++ ## +## This project can be built to debug and run all nested projects ## +## Or, any subdirectory with a project() statement can be selected ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project( diff --git a/cpp/algorithms/CMakeLists.txt b/cpp/algorithms/CMakeLists.txt index 62d9e77..fbad495 100644 --- a/cpp/algorithms/CMakeLists.txt +++ b/cpp/algorithms/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing algorithms in C++ ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing algorithms in C++ ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/algorithms/graphs/CMakeLists.txt b/cpp/algorithms/graphs/CMakeLists.txt index 78d872b..a41cace 100644 --- a/cpp/algorithms/graphs/CMakeLists.txt +++ b/cpp/algorithms/graphs/CMakeLists.txt @@ -1,11 +1,11 @@ ############################################################################### ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A root project for practicing graph algorithms in C++ ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ############################################################################## -# + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/algorithms/graphs/object/CMakeLists.txt b/cpp/algorithms/graphs/object/CMakeLists.txt index 0e5d2e6..480cb19 100644 --- a/cpp/algorithms/graphs/object/CMakeLists.txt +++ b/cpp/algorithms/graphs/object/CMakeLists.txt @@ -1,11 +1,10 @@ ################################################################################ ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A root project for practicing graph algorithms in C++ ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ################################################################################ -# cmake_minimum_required(VERSION 3.15) @@ -16,7 +15,7 @@ project( LANGUAGES CXX ) -add_library(lib-graph-object "lib-graph.cpp") - -add_executable(graph-test-object "graph.cpp") -target_link_libraries(graph-test-object lib-graph-object) +add_executable( + algo-graphs-object graph.cpp + lib-graph.cpp lib-graph.hpp +) diff --git a/cpp/algorithms/graphs/simple/CMakeLists.txt b/cpp/algorithms/graphs/simple/CMakeLists.txt index 34fc97a..b22134d 100644 --- a/cpp/algorithms/graphs/simple/CMakeLists.txt +++ b/cpp/algorithms/graphs/simple/CMakeLists.txt @@ -1,11 +1,10 @@ ############################################################################### ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A CMakeLists configuration to test a simple graph implementation ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ############################################################################## -# cmake_minimum_required(VERSION 3.15) @@ -16,7 +15,7 @@ project( LANGUAGES CXX ) -add_library(lib-graph-simple "lib-graph.cpp") - -add_executable(graph-test-simple "graph.cpp") -target_link_libraries(graph-test-simple lib-graph-simple) +add_executable( + algo-graphs-simple graph.cpp + lib-graph.cpp lib-graph.hpp +) diff --git a/cpp/algorithms/graphs/templated/CMakeLists.txt b/cpp/algorithms/graphs/templated/CMakeLists.txt index 7b7e808..86df5db 100644 --- a/cpp/algorithms/graphs/templated/CMakeLists.txt +++ b/cpp/algorithms/graphs/templated/CMakeLists.txt @@ -1,11 +1,10 @@ ################################################################################ ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A basic CMakeLists to test templated graph implementation ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ################################################################################ -# cmake_minimum_required(VERSION 3.15) @@ -16,7 +15,4 @@ project( LANGUAGES CXX ) -#add_library(lib-graph-templated "lib-graph.cpp") - -add_executable(graph-test-templated "graph.cpp") -#target_link_libraries(graph-test-templated lib-graph-templated) +add_executable(algo-graphs-templated graph.cpp) diff --git a/cpp/algorithms/graphs/templated/lib-graph.cpp b/cpp/algorithms/graphs/templated/lib-graph.cpp deleted file mode 100644 index 5fffd73..0000000 --- a/cpp/algorithms/graphs/templated/lib-graph.cpp +++ /dev/null @@ -1,12 +0,0 @@ -/*############################################################################## -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: Driver program to test object graph implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -################################################################################ -*/ - -#include "lib-graph.hpp" - - diff --git a/cpp/algorithms/graphs/weighted/CMakeLists.txt b/cpp/algorithms/graphs/weighted/CMakeLists.txt index f99e265..4680dbe 100644 --- a/cpp/algorithms/graphs/weighted/CMakeLists.txt +++ b/cpp/algorithms/graphs/weighted/CMakeLists.txt @@ -1,11 +1,10 @@ ################################################################################ ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A basic CMakeLists configuration to test RBT implementation ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ################################################################################ -# cmake_minimum_required(VERSION 3.15) @@ -16,7 +15,7 @@ project( LANGUAGES CXX ) -add_library(lib-graph-weighted "lib-graph.cpp") - -add_executable(graph-test-weighted "graph.cpp") -target_link_libraries(graph-test-weighted lib-graph-weighted) +add_executable( + algo-graphs-weighted graph.cpp + lib-graph.cpp lib-graph.hpp +) diff --git a/cpp/algorithms/sorting/CMakeLists.txt b/cpp/algorithms/sorting/CMakeLists.txt index 59de505..2a590be 100644 --- a/cpp/algorithms/sorting/CMakeLists.txt +++ b/cpp/algorithms/sorting/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing sorting algorithms in C++ ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing sorting algorithms in C++ ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/algorithms/sorting/bubble/CMakeLists.txt b/cpp/algorithms/sorting/bubble/CMakeLists.txt index 5a5f1d9..db3b560 100644 --- a/cpp/algorithms/sorting/bubble/CMakeLists.txt +++ b/cpp/algorithms/sorting/bubble/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################### ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A basic CMakeLists configuration to practice bubble sort ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16) project(BubbleSort LANGUAGES CXX) -add_executable(bubble-sort "bubble-sort.cpp") - -add_library(lib-bubble "lib-bubble.cpp") -target_link_libraries(bubble-sort lib-bubble) +add_executable( + algo-sort-bubble bubble-sort.cpp + lib-bubble.cpp lib-bubble.hpp +) diff --git a/cpp/algorithms/sorting/bubble/bubble-sort.cpp b/cpp/algorithms/sorting/bubble/bubble-sort.cpp index 721db2a..d065a52 100644 --- a/cpp/algorithms/sorting/bubble/bubble-sort.cpp +++ b/cpp/algorithms/sorting/bubble/bubble-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bubble sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/bubble/lib-bubble.cpp b/cpp/algorithms/sorting/bubble/lib-bubble.cpp index 7e467e1..17810f0 100644 --- a/cpp/algorithms/sorting/bubble/lib-bubble.cpp +++ b/cpp/algorithms/sorting/bubble/lib-bubble.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bubble sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/bubble/lib-bubble.hpp b/cpp/algorithms/sorting/bubble/lib-bubble.hpp index 886ca42..2a303ef 100644 --- a/cpp/algorithms/sorting/bubble/lib-bubble.hpp +++ b/cpp/algorithms/sorting/bubble/lib-bubble.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bubble sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/bucket/CMakeLists.txt b/cpp/algorithms/sorting/bucket/CMakeLists.txt index 79543d1..f1f893d 100644 --- a/cpp/algorithms/sorting/bucket/CMakeLists.txt +++ b/cpp/algorithms/sorting/bucket/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################### ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A basic CMakeLists configuration to practice bucket sort ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16) project(BucketSort LANGUAGES CXX) -add_executable(bucket-sort "bucket-sort.cpp") - -add_library(lib-bucket "lib-bucket.cpp") -target_link_libraries(bucket-sort lib-bucket) +add_executable( + algo-sort-bucket bucket-sort.cpp + lib-bucket.cpp lib-bucket.hpp +) diff --git a/cpp/algorithms/sorting/bucket/bucket-sort.cpp b/cpp/algorithms/sorting/bucket/bucket-sort.cpp index df2e1f1..584719c 100644 --- a/cpp/algorithms/sorting/bucket/bucket-sort.cpp +++ b/cpp/algorithms/sorting/bucket/bucket-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bucket sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/bucket/lib-bucket.cpp b/cpp/algorithms/sorting/bucket/lib-bucket.cpp index e8cb365..4a450a3 100644 --- a/cpp/algorithms/sorting/bucket/lib-bucket.cpp +++ b/cpp/algorithms/sorting/bucket/lib-bucket.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bucket sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/bucket/lib-bucket.hpp b/cpp/algorithms/sorting/bucket/lib-bucket.hpp index 053db87..9ce2946 100644 --- a/cpp/algorithms/sorting/bucket/lib-bucket.hpp +++ b/cpp/algorithms/sorting/bucket/lib-bucket.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of bucket sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/count/CMakeLists.txt b/cpp/algorithms/sorting/count/CMakeLists.txt index 38c0bdf..f90ea11 100644 --- a/cpp/algorithms/sorting/count/CMakeLists.txt +++ b/cpp/algorithms/sorting/count/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################### ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: A basic CMakeLists configuration to practice counting sort ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16) project(CountingSort LANGUAGES CXX) -add_executable(counting-sort "counting-sort.cpp") - -add_library(lib-counting "lib-counting.cpp") -target_link_libraries(counting-sort lib-counting) +add_executable( + algo-sort-counting counting-sort.cpp + lib-counting.cpp lib-counting.hpp +) diff --git a/cpp/algorithms/sorting/count/counting-sort.cpp b/cpp/algorithms/sorting/count/counting-sort.cpp index 92c0619..567543f 100644 --- a/cpp/algorithms/sorting/count/counting-sort.cpp +++ b/cpp/algorithms/sorting/count/counting-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of counting sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/count/lib-counting.cpp b/cpp/algorithms/sorting/count/lib-counting.cpp index 8558e2e..36b5139 100644 --- a/cpp/algorithms/sorting/count/lib-counting.cpp +++ b/cpp/algorithms/sorting/count/lib-counting.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of counting sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## @@ -35,13 +35,17 @@ void CountingSort(std::vector &array) // + Since each element stores its own count, just add the count at index i-1 for (size_t i = 1; i <= maxValue; i++) { tempArray[i] += tempArray[i - 1]; + // tempArray[i] - 1 now represents the sorted 0-index pos for each value i } + // Step through the array from right-to-left and place each value in their pos + // + As we run into values lookup their position with tempArray[value] for (ssize_t arrayIndex = array.size() - 1; arrayIndex >= 0; arrayIndex--) { - // Store as references; Changes reflect on actual values within each array const int &arrayValue = array[arrayIndex]; + // Store as reference; Changes to valueCount reflect within tempArray int &valueCount = tempArray[arrayValue]; sortedArray[valueCount - 1] = arrayValue; + // Subtract from tempArray[arrayValue] to update position of next occurrence valueCount = valueCount - 1; } diff --git a/cpp/algorithms/sorting/count/lib-counting.hpp b/cpp/algorithms/sorting/count/lib-counting.hpp index 86e4e87..a439129 100644 --- a/cpp/algorithms/sorting/count/lib-counting.hpp +++ b/cpp/algorithms/sorting/count/lib-counting.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of counting sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/heap/CMakeLists.txt b/cpp/algorithms/sorting/heap/CMakeLists.txt index 20a60dc..619ccbf 100644 --- a/cpp/algorithms/sorting/heap/CMakeLists.txt +++ b/cpp/algorithms/sorting/heap/CMakeLists.txt @@ -9,7 +9,8 @@ cmake_minimum_required(VERSION 3.16) project(HeapSort LANGUAGES CXX) -add_executable(heap-sort "heap-sort.cpp") +add_executable( + algo-sort-heap heap-sort.cpp + lib-heap.cpp lib-heap.hpp +) -add_library(lib-heap "lib-heap.cpp") -target_link_libraries(heap-sort lib-heap) diff --git a/cpp/algorithms/sorting/heap/heap-sort.cpp b/cpp/algorithms/sorting/heap/heap-sort.cpp index dc3b360..73552f7 100644 --- a/cpp/algorithms/sorting/heap/heap-sort.cpp +++ b/cpp/algorithms/sorting/heap/heap-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of heap sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/heap/lib-heap.cpp b/cpp/algorithms/sorting/heap/lib-heap.cpp index 80c7ff1..0c1840e 100644 --- a/cpp/algorithms/sorting/heap/lib-heap.cpp +++ b/cpp/algorithms/sorting/heap/lib-heap.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of heap sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/heap/lib-heap.hpp b/cpp/algorithms/sorting/heap/lib-heap.hpp index a7afb02..d05bb42 100644 --- a/cpp/algorithms/sorting/heap/lib-heap.hpp +++ b/cpp/algorithms/sorting/heap/lib-heap.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of heap sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/insertion/CMakeLists.txt b/cpp/algorithms/sorting/insertion/CMakeLists.txt index 02e273d..8ee95e8 100644 --- a/cpp/algorithms/sorting/insertion/CMakeLists.txt +++ b/cpp/algorithms/sorting/insertion/CMakeLists.txt @@ -1,15 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to practice insertion sort ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################### +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to practice insertion sort ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ cmake_minimum_required(VERSION 3.16) -project(InsertionSort LANGUAGES CXX) -add_executable(insertion-sort "insertion-sort.cpp") +project ( + #[[NAME]] InsertionSort + VERSION 1.0 + DESCRIPTION "A project for practicing insertion sort in C++" + LANGUAGES CXX +) -add_library(lib-insertion "lib-insertion.cpp") -target_link_libraries(insertion-sort lib-insertion) +add_executable( + algo-sort-insertion insertion-sort.cpp + lib-insertion.cpp lib-insertion.hpp +) diff --git a/cpp/algorithms/sorting/insertion/insertion-sort.cpp b/cpp/algorithms/sorting/insertion/insertion-sort.cpp index c405f17..3c50144 100644 --- a/cpp/algorithms/sorting/insertion/insertion-sort.cpp +++ b/cpp/algorithms/sorting/insertion/insertion-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of insertion sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/insertion/lib-insertion.cpp b/cpp/algorithms/sorting/insertion/lib-insertion.cpp index f6f2708..b6aa11d 100644 --- a/cpp/algorithms/sorting/insertion/lib-insertion.cpp +++ b/cpp/algorithms/sorting/insertion/lib-insertion.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of insertion sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## @@ -9,7 +9,6 @@ #include "lib-insertion.hpp" -#include #include void InsertionSort(std::vector &array) diff --git a/cpp/algorithms/sorting/insertion/lib-insertion.hpp b/cpp/algorithms/sorting/insertion/lib-insertion.hpp index c0409ce..685ba99 100644 --- a/cpp/algorithms/sorting/insertion/lib-insertion.hpp +++ b/cpp/algorithms/sorting/insertion/lib-insertion.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of insertion sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/merge/CMakeLists.txt b/cpp/algorithms/sorting/merge/CMakeLists.txt index 230ef08..c85d4f2 100644 --- a/cpp/algorithms/sorting/merge/CMakeLists.txt +++ b/cpp/algorithms/sorting/merge/CMakeLists.txt @@ -1,15 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to practice merge sort ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################### +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to practice merge sort ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ cmake_minimum_required(VERSION 3.17) -project(MergeSort LANGUAGES CXX) -add_executable(merge-sort "merge-sort.cpp") +project ( + #[[NAME]] MergeSort + VERSION 1.0 + DESCRIPTION "A project for practicing merge sort in C++" + LANGUAGES CXX +) +add_executable( + algo-sort-merge merge-sort.cpp + lib-merge.cpp lib-merge.h +) -add_library(lib-merge "lib-merge.cpp") -target_link_libraries(merge-sort lib-merge) diff --git a/cpp/algorithms/sorting/merge/lib-merge.cpp b/cpp/algorithms/sorting/merge/lib-merge.cpp index 2d43e2c..b31a4fe 100644 --- a/cpp/algorithms/sorting/merge/lib-merge.cpp +++ b/cpp/algorithms/sorting/merge/lib-merge.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of merge sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/merge/lib-merge.h b/cpp/algorithms/sorting/merge/lib-merge.h index 5e5c31d..001444e 100644 --- a/cpp/algorithms/sorting/merge/lib-merge.h +++ b/cpp/algorithms/sorting/merge/lib-merge.h @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of merge sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/merge/merge-sort.cpp b/cpp/algorithms/sorting/merge/merge-sort.cpp index ad75338..01f5588 100644 --- a/cpp/algorithms/sorting/merge/merge-sort.cpp +++ b/cpp/algorithms/sorting/merge/merge-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of merge sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/quick/CMakeLists.txt b/cpp/algorithms/sorting/quick/CMakeLists.txt index 8c51589..63da599 100644 --- a/cpp/algorithms/sorting/quick/CMakeLists.txt +++ b/cpp/algorithms/sorting/quick/CMakeLists.txt @@ -1,15 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to practice quick sort ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################### +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to practice quick sort ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ cmake_minimum_required(VERSION 3.16) -project(QuickSort LANGUAGES CXX) -add_executable(quick-sort "quick-sort.cpp") +project ( + #[[NAME]] QuickSort + VERSION 1.0 + DESCRIPTION "A project for practicing quick sort in C++" + LANGUAGES CXX +) -add_library(lib-quick "lib-quick.cpp") -target_link_libraries(quick-sort lib-quick) +add_executable( + algo-sort-quick quick-sort.cpp + lib-quick.cpp lib-quick.hpp +) diff --git a/cpp/algorithms/sorting/quick/lib-quick.cpp b/cpp/algorithms/sorting/quick/lib-quick.cpp index e6a7a4a..435226b 100644 --- a/cpp/algorithms/sorting/quick/lib-quick.cpp +++ b/cpp/algorithms/sorting/quick/lib-quick.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of quick sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/quick/lib-quick.hpp b/cpp/algorithms/sorting/quick/lib-quick.hpp index 15c8855..b0af42c 100644 --- a/cpp/algorithms/sorting/quick/lib-quick.hpp +++ b/cpp/algorithms/sorting/quick/lib-quick.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of quick sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/quick/quick-sort.cpp b/cpp/algorithms/sorting/quick/quick-sort.cpp index 2720c36..488e51e 100644 --- a/cpp/algorithms/sorting/quick/quick-sort.cpp +++ b/cpp/algorithms/sorting/quick/quick-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of quick sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/radix/CMakeLists.txt b/cpp/algorithms/sorting/radix/CMakeLists.txt index 5c181a2..cbcfd5e 100644 --- a/cpp/algorithms/sorting/radix/CMakeLists.txt +++ b/cpp/algorithms/sorting/radix/CMakeLists.txt @@ -1,17 +1,22 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to practice radix sort ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################### +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to practice radix sort ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ cmake_minimum_required(VERSION 3.16) -project(RadixSort LANGUAGES CXX) -add_executable(radix-sort "radix-sort.cpp") +project ( + #[[NAME]] RadixSort + VERSION 1.0 + DESCRIPTION "A project for practicing radix sort in C++" + LANGUAGES CXX +) -add_library(lib-radix-counting "lib-counting.cpp") -add_library(lib-radix "lib-radix.cpp") - -target_link_libraries(radix-sort lib-radix lib-radix-counting) +add_executable( + algo-sort-radix radix-sort.cpp + lib-counting.cpp lib-counting.hpp + lib-radix.cpp lib-radix.hpp +) diff --git a/cpp/algorithms/sorting/radix/lib-counting.cpp b/cpp/algorithms/sorting/radix/lib-counting.cpp index 53cb154..702fe12 100644 --- a/cpp/algorithms/sorting/radix/lib-counting.cpp +++ b/cpp/algorithms/sorting/radix/lib-counting.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of counting sort using a custom library ## ## + In support of a radix sort implementation ## ## ## diff --git a/cpp/algorithms/sorting/radix/lib-counting.hpp b/cpp/algorithms/sorting/radix/lib-counting.hpp index 2fb09b8..80f8d27 100644 --- a/cpp/algorithms/sorting/radix/lib-counting.hpp +++ b/cpp/algorithms/sorting/radix/lib-counting.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of counting sort using a custom library ## ## + In support of a radix sort implementation ## ## ## diff --git a/cpp/algorithms/sorting/radix/lib-radix.cpp b/cpp/algorithms/sorting/radix/lib-radix.cpp index 0bee905..87295fc 100644 --- a/cpp/algorithms/sorting/radix/lib-radix.cpp +++ b/cpp/algorithms/sorting/radix/lib-radix.cpp @@ -1,3 +1,11 @@ +/*############################################################################# +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example implementation of radix sort using a custom library ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +############################################################################### +*/ #include "lib-radix.hpp" #include "lib-counting.hpp" diff --git a/cpp/algorithms/sorting/radix/lib-radix.hpp b/cpp/algorithms/sorting/radix/lib-radix.hpp index a83fe60..3b64e70 100644 --- a/cpp/algorithms/sorting/radix/lib-radix.hpp +++ b/cpp/algorithms/sorting/radix/lib-radix.hpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of radix sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/radix/radix-sort.cpp b/cpp/algorithms/sorting/radix/radix-sort.cpp index 45cbb15..0219e2c 100644 --- a/cpp/algorithms/sorting/radix/radix-sort.cpp +++ b/cpp/algorithms/sorting/radix/radix-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of radix sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/selection/CMakeLists.txt b/cpp/algorithms/sorting/selection/CMakeLists.txt index 140ba07..b3cf0e8 100644 --- a/cpp/algorithms/sorting/selection/CMakeLists.txt +++ b/cpp/algorithms/sorting/selection/CMakeLists.txt @@ -1,15 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to practice selection sort ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################### +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to practice selection sort ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ cmake_minimum_required(VERSION 3.16) -project(SelectionSort LANGUAGES CXX) -add_executable(select-sort "select-sort.cpp") +project ( + #[[NAME]] SelectionSort + VERSION 1.0 + DESCRIPTION "A project for practicing selection sort in C++" + LANGUAGES CXX +) -add_library(lib-select "lib-select.cpp") -target_link_libraries(select-sort lib-select) +add_executable( + algo-sort-select select-sort.cpp + lib-select.cpp lib-select.h +) diff --git a/cpp/algorithms/sorting/selection/lib-select.cpp b/cpp/algorithms/sorting/selection/lib-select.cpp index 0bb68f9..d22946b 100644 --- a/cpp/algorithms/sorting/selection/lib-select.cpp +++ b/cpp/algorithms/sorting/selection/lib-select.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of selection sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/selection/lib-select.h b/cpp/algorithms/sorting/selection/lib-select.h index c826062..ca539fb 100644 --- a/cpp/algorithms/sorting/selection/lib-select.h +++ b/cpp/algorithms/sorting/selection/lib-select.h @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of selection sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/sorting/selection/select-sort.cpp b/cpp/algorithms/sorting/selection/select-sort.cpp index 46c5301..97ef01e 100644 --- a/cpp/algorithms/sorting/selection/select-sort.cpp +++ b/cpp/algorithms/sorting/selection/select-sort.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example implementation of selection sort using a custom library ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/trees/CMakeLists.txt b/cpp/algorithms/trees/CMakeLists.txt index 80c2f3d..5e27b4a 100644 --- a/cpp/algorithms/trees/CMakeLists.txt +++ b/cpp/algorithms/trees/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing algorithms in C++ ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing algorithms in C++ ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/algorithms/trees/binary/CMakeLists.txt b/cpp/algorithms/trees/binary/CMakeLists.txt index ba7d12f..dcd8c25 100644 --- a/cpp/algorithms/trees/binary/CMakeLists.txt +++ b/cpp/algorithms/trees/binary/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to test BST implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to test BST implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( @@ -15,7 +15,7 @@ project ( LANGUAGES CXX ) -add_library(lib-bst-algo "bst.cpp") - -add_executable(test-bst-algo "driver.cpp") -target_link_libraries(test-bst-algo lib-bst-algo) +add_executable( + algo-trees-bst driver.cpp + bst.cpp bst.h +) diff --git a/cpp/algorithms/trees/binary/bst.cpp b/cpp/algorithms/trees/binary/bst.cpp index e7a4440..50c0594 100644 --- a/cpp/algorithms/trees/binary/bst.cpp +++ b/cpp/algorithms/trees/binary/bst.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example of a binary search tree implementation ## ## The algorithms in this example are seen in MIT Intro to Algorithms ## ## ## diff --git a/cpp/algorithms/trees/binary/bst.h b/cpp/algorithms/trees/binary/bst.h index d0f0b2f..68eac4b 100644 --- a/cpp/algorithms/trees/binary/bst.h +++ b/cpp/algorithms/trees/binary/bst.h @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example of a binary search tree implementation ## ## The algorithms in this example are seen in MIT Intro to Algorithms ## ## ## diff --git a/cpp/algorithms/trees/binary/driver.cpp b/cpp/algorithms/trees/binary/driver.cpp index 9bb837b..e02fa0e 100644 --- a/cpp/algorithms/trees/binary/driver.cpp +++ b/cpp/algorithms/trees/binary/driver.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: Driver program to test BST algorithms from MIT intro to algorithms ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/trees/redblack/CMakeLists.txt b/cpp/algorithms/trees/redblack/CMakeLists.txt index 14cf7c9..9c1206a 100644 --- a/cpp/algorithms/trees/redblack/CMakeLists.txt +++ b/cpp/algorithms/trees/redblack/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to test RBT implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to test RBT implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( @@ -15,7 +15,7 @@ project ( LANGUAGES CXX ) -add_library(lib-redblack "redblack.cpp") - -add_executable(test-redblack "driver.cpp") -target_link_libraries(test-redblack lib-redblack) +add_executable( + algo-trees-redblack driver.cpp + redblack.cpp redblack.h +) diff --git a/cpp/algorithms/trees/redblack/driver.cpp b/cpp/algorithms/trees/redblack/driver.cpp index cd0c529..725c38c 100644 --- a/cpp/algorithms/trees/redblack/driver.cpp +++ b/cpp/algorithms/trees/redblack/driver.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: Driver program to test RBT algorithms from MIT intro to algorithms ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## diff --git a/cpp/algorithms/trees/redblack/redblack.cpp b/cpp/algorithms/trees/redblack/redblack.cpp index cc8267e..7128e2b 100644 --- a/cpp/algorithms/trees/redblack/redblack.cpp +++ b/cpp/algorithms/trees/redblack/redblack.cpp @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example of a red-black tree implementation ## ## The algorithms in this example are seen in MIT Intro to Algorithms ## ## ## diff --git a/cpp/algorithms/trees/redblack/redblack.h b/cpp/algorithms/trees/redblack/redblack.h index d8113ba..dc57053 100644 --- a/cpp/algorithms/trees/redblack/redblack.h +++ b/cpp/algorithms/trees/redblack/redblack.h @@ -1,6 +1,6 @@ /*############################################################################# ## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## ## About: An example of a red black tree implementation ## ## The algorithms in this example are seen in MIT Intro to Algorithms ## ## ## diff --git a/cpp/cmake-example/CMakeLists.txt b/cpp/cmake-example/CMakeLists.txt index 0878f76..bebd5a6 100644 --- a/cpp/cmake-example/CMakeLists.txt +++ b/cpp/cmake-example/CMakeLists.txt @@ -1,19 +1,27 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## -## About: A template project for getting started working with CMake ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A template project for getting started working with CMake ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ # Define the version of CMake cmake_minimum_required(VERSION 3.15) +# CMake options set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# Compiler options +add_compile_options("-Wall") + # Define the your project name -project(cmake-template) +project ( + #[[NAME]] CMakeTemplate + VERSION 1.0 + DESCRIPTION "A basic CMake template for C++ projects" + LANGUAGES CXX +) # Include any directories the compiler may need include_directories(./include) diff --git a/cpp/cmake-example/apps/CMakeLists.txt b/cpp/cmake-example/apps/CMakeLists.txt index be67004..e146a97 100644 --- a/cpp/cmake-example/apps/CMakeLists.txt +++ b/cpp/cmake-example/apps/CMakeLists.txt @@ -1,17 +1,16 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ ## This directory is for storing / compiling our executable code # Create a reference / variable to refer to our source code set(APP_SRC say-hello.cpp) # Add our executable, naming it and linking it to our source code -add_executable(say-hello ${APP_SRC}) +add_executable(cmake-example-template ${APP_SRC}) # Link to our custom library, defined in c-cmake/src/ -target_link_libraries(say-hello lib-klips) - +target_link_libraries(cmake-example-template cmake-example-lib) diff --git a/cpp/cmake-example/apps/say-hello.cpp b/cpp/cmake-example/apps/say-hello.cpp index 9be5ac2..82b904a 100644 --- a/cpp/cmake-example/apps/say-hello.cpp +++ b/cpp/cmake-example/apps/say-hello.cpp @@ -6,7 +6,7 @@ ################################################################################ */ -#include +#include #include int main () { diff --git a/cpp/cmake-example/include/lib-klips.hpp b/cpp/cmake-example/include/lib-example.hpp similarity index 100% rename from cpp/cmake-example/include/lib-klips.hpp rename to cpp/cmake-example/include/lib-example.hpp diff --git a/cpp/cmake-example/src/CMakeLists.txt b/cpp/cmake-example/src/CMakeLists.txt index b8a1137..7ef19c1 100644 --- a/cpp/cmake-example/src/CMakeLists.txt +++ b/cpp/cmake-example/src/CMakeLists.txt @@ -1,14 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ ## This directory is for storing source code # Create any links we might need -set(LIB_SRC lib-klips.cpp) +set(LIB_SRC lib-example.cpp) # Define our library within CMake and link to the source code -add_library(lib-klips ${LIB_SRC}) - +add_library(cmake-example-lib ${LIB_SRC}) diff --git a/cpp/cmake-example/src/lib-klips.cpp b/cpp/cmake-example/src/lib-example.cpp similarity index 95% rename from cpp/cmake-example/src/lib-klips.cpp rename to cpp/cmake-example/src/lib-example.cpp index 8c18fbb..3a1c0e8 100644 --- a/cpp/cmake-example/src/lib-klips.cpp +++ b/cpp/cmake-example/src/lib-example.cpp @@ -6,7 +6,7 @@ ################################################################################ */ -#include +#include #include void PrintHello(int n) { diff --git a/cpp/cryptography/CMakeLists.txt b/cpp/cryptography/CMakeLists.txt index 3a553ca..af34ed4 100644 --- a/cpp/cryptography/CMakeLists.txt +++ b/cpp/cryptography/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing cryptography in C++ ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## About: A root project for practicing cryptography in C++ ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/cryptography/columnar-transposition/CMakeLists.txt b/cpp/cryptography/columnar-transposition/CMakeLists.txt index 5b54e7f..2cfd4f6 100644 --- a/cpp/cryptography/columnar-transposition/CMakeLists.txt +++ b/cpp/cryptography/columnar-transposition/CMakeLists.txt @@ -5,7 +5,6 @@ ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ################################################################################ -# cmake_minimum_required(VERSION 3.15) @@ -16,7 +15,7 @@ project( LANGUAGES CXX ) -add_library(lib-cipher "lib-cipher.cpp") - -add_executable(columnar-transposition-test "driver.cpp") -target_link_libraries(columnar-transposition-test lib-cipher) +add_executable( + crypto-columnar-transposition driver.cpp + lib-cipher.cpp lib-cipher.hpp +) diff --git a/cpp/datastructs/CMakeLists.txt b/cpp/datastructs/CMakeLists.txt index 25a99f6..09211a8 100644 --- a/cpp/datastructs/CMakeLists.txt +++ b/cpp/datastructs/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing C++ data structure implementations ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing C++ data structure implementations ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/datastructs/binarysearchtree/CMakeLists.txt b/cpp/datastructs/binarysearchtree/CMakeLists.txt index e3a095d..4c0155f 100644 --- a/cpp/datastructs/binarysearchtree/CMakeLists.txt +++ b/cpp/datastructs/binarysearchtree/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to test BST implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to test BST implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( @@ -15,7 +15,7 @@ project ( LANGUAGES CXX ) -add_library(lib-bst "bst.cpp") - -add_executable(test-bst "driver.cpp") -target_link_libraries(test-bst lib-bst) +add_executable( + data-bst driver.cpp + bst.cpp bst.h +) diff --git a/cpp/datastructs/circledoublelist/CMakeLists.txt b/cpp/datastructs/circledoublelist/CMakeLists.txt index 617aa60..fb0e22d 100644 --- a/cpp/datastructs/circledoublelist/CMakeLists.txt +++ b/cpp/datastructs/circledoublelist/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a circular doubly linked list implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a circular doubly linked list implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(CircleDouble) -# Define source files -set(SRC driver.cpp circledoublelist.cpp) -# Build an executable -add_executable(CircleDoubleDriver ${SRC}) +project ( + #[[NAME]] CircleDoubleList + VERSION 1.0 + DESCRIPTION "Project for testing circular doubly linked list implementation" + LANGUAGES CXX +) + +add_executable( + data-circular-doubly-linked-list driver.cpp + circledoublelist.cpp circledoublelist.h +) diff --git a/cpp/datastructs/circlesinglelist/CMakeLists.txt b/cpp/datastructs/circlesinglelist/CMakeLists.txt index cf30bce..5459a9d 100644 --- a/cpp/datastructs/circlesinglelist/CMakeLists.txt +++ b/cpp/datastructs/circlesinglelist/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a circular singly linked list implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a circular singly linked list implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(CircleSingle) -# Define source files -set(SRC driver.cpp circlesinglelist.cpp) -# Build an executable -add_executable(CircleSingleDriver ${SRC}) +project ( + #[[NAME]] CircleSingleList + VERSION 1.0 + DESCRIPTION "Project for testing circular singly linked list implementation" + LANGUAGES CXX +) + +add_executable( + data-circular-singly-linked-list driver.cpp + circlesinglelist.cpp circlesinglelist.h +) diff --git a/cpp/datastructs/doublelist/CMakeLists.txt b/cpp/datastructs/doublelist/CMakeLists.txt index 6e0066a..7db1398 100644 --- a/cpp/datastructs/doublelist/CMakeLists.txt +++ b/cpp/datastructs/doublelist/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a doubly linked list implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a doubly linked list implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(DoubleList) -# Define source files -set(SRC driver.cpp doublelist.cpp) -# Build an executable -add_executable(DoubleListDriver ${SRC}) +project ( + #[[NAME]] DoubleList + VERSION 1.0 + DESCRIPTION "A project for testing a doubly linked list implementation" + LANGUAGES CXX +) + +add_executable( + data-doubly-linked-list driver.cpp + doublelist.cpp doublelist.h +) diff --git a/cpp/datastructs/maxheap/CMakeLists.txt b/cpp/datastructs/maxheap/CMakeLists.txt index 7ab3acb..a946abc 100644 --- a/cpp/datastructs/maxheap/CMakeLists.txt +++ b/cpp/datastructs/maxheap/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a max heap implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a max heap implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(MaxHeap) -# Define source files -set(SRC driver.cpp maxheap.cpp) -# Build an executable -add_executable(HeapDriver ${SRC}) +project ( + #[[NAME]] MaxHeap + VERSION 1.0 + DESCRIPTION "A project for testing a max heap implementation" + LANGUAGES CXX +) + +add_executable( + data-max-heap driver.cpp + maxheap.cpp maxheap.h +) diff --git a/cpp/datastructs/queuelist/CMakeLists.txt b/cpp/datastructs/queuelist/CMakeLists.txt index 3616227..648f1a8 100644 --- a/cpp/datastructs/queuelist/CMakeLists.txt +++ b/cpp/datastructs/queuelist/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a queue implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a queue implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(Queue) -# Define source files -set(SRC driver.cpp queuelist.cpp) -# Build an executable -add_executable(QueueDriver ${SRC}) +project ( + #[[NAME]] Queue + VERSION 1.0 + DESCRIPTION "Project for testing queue implementation" + LANGUAGES CXX +) + +add_executable( + data-queue driver.cpp + queuelist.cpp queuelist.h +) diff --git a/cpp/datastructs/singlelist/CMakeLists.txt b/cpp/datastructs/singlelist/CMakeLists.txt index 375b9f4..49840df 100644 --- a/cpp/datastructs/singlelist/CMakeLists.txt +++ b/cpp/datastructs/singlelist/CMakeLists.txt @@ -1,16 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a singly linked list implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a singly linked list implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(SingleList) -# Define source files -set(SRC driver.cpp singlelist.cpp) -# Build an executable -add_executable(SingleListDriver ${SRC}) +project ( + #[[NAME]] SingleList + VERSION 1.0 + DESCRIPTION "A project for testing a singly linked list implementation" + LANGUAGES CXX +) + +add_executable( + data-singly-linked-list driver.cpp + singlelist.cpp singlelist.h +) diff --git a/cpp/datastructs/stacklist/CMakeLists.txt b/cpp/datastructs/stacklist/CMakeLists.txt index 56c849a..6f96090 100644 --- a/cpp/datastructs/stacklist/CMakeLists.txt +++ b/cpp/datastructs/stacklist/CMakeLists.txt @@ -1,17 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a stack implementation using linked lists ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -## CMakeLists.txt -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a stack implementation using linked lists ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(Stack) -# Define source files -set(SRC driver.cpp stacklist.cpp) -# Build an executable -add_executable(StackDriver ${SRC}) +project ( + #[[NAME]] Stack + VERSION 1.0 + DESCRIPTION "A project for testing a Stack implementation" + LANGUAGES CXX +) + +add_executable( + data-stack driver.cpp + stacklist.cpp stacklist.h +) diff --git a/cpp/datastructs/templates/CMakeLists.txt b/cpp/datastructs/templates/CMakeLists.txt index 5f0482b..62220d0 100644 --- a/cpp/datastructs/templates/CMakeLists.txt +++ b/cpp/datastructs/templates/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing templated data structures in C++ ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A root project for practicing templated data structures in C++ ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project ( diff --git a/cpp/datastructs/templates/doublelist/CMakeLists.txt b/cpp/datastructs/templates/doublelist/CMakeLists.txt index 5c18484..51d3368 100644 --- a/cpp/datastructs/templates/doublelist/CMakeLists.txt +++ b/cpp/datastructs/templates/doublelist/CMakeLists.txt @@ -1,16 +1,18 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a doubly linked list implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a templated doubly linked list implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(DoubleList) -# Define source files -set(SRC driver.cpp) -# Build an executable -add_executable(TemplatedDoubleListDriver ${SRC}) +project ( + #[[NAME]] TemplatedDoubleList + VERSION 1.0 + DESCRIPTION "A project for practicing templated doubly linked list implementations" + LANGUAGES CXX +) + +add_executable(data-templates-doubly-linked-list driver.cpp) diff --git a/cpp/datastructs/templates/queuelist/CMakeLists.txt b/cpp/datastructs/templates/queuelist/CMakeLists.txt index 8faf2f6..606dc06 100644 --- a/cpp/datastructs/templates/queuelist/CMakeLists.txt +++ b/cpp/datastructs/templates/queuelist/CMakeLists.txt @@ -1,16 +1,18 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a queue implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a templated queue implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(Queue) -# Define source files -set(SRC driver.cpp) -# Build an executable -add_executable(TemplatedQueueDriver ${SRC}) +project ( + #[[NAME]] TemplatedQueue + VERSION 1.0 + DESCRIPTION "A project for practicing templated queue implementations" + LANGUAGES CXX +) + +add_executable(data-templates-queue driver.cpp) diff --git a/cpp/datastructs/templates/stacklist/CMakeLists.txt b/cpp/datastructs/templates/stacklist/CMakeLists.txt index ee69828..19aae07 100644 --- a/cpp/datastructs/templates/stacklist/CMakeLists.txt +++ b/cpp/datastructs/templates/stacklist/CMakeLists.txt @@ -1,16 +1,18 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: An example of a stack implementation using linked lists ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a templated stack implementation using linked lists ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(Stack) -# Define source files -set(SRC driver.cpp) -# Build an executable -add_executable(TemplatedStackDriver ${SRC}) +project ( + #[[NAME]] TemplatedStack + VERSION 1.0 + DESCRIPTION "A project for practicing templated Stack implementations" + LANGUAGES CXX +) + +add_executable(data-templates-stack driver.cpp) diff --git a/cpp/datastructs/templates/vector/CMakeLists.txt b/cpp/datastructs/templates/vector/CMakeLists.txt index d81197f..14bf52c 100644 --- a/cpp/datastructs/templates/vector/CMakeLists.txt +++ b/cpp/datastructs/templates/vector/CMakeLists.txt @@ -1,17 +1,18 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to test Vector implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -## vector.cpp -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: An example of a templated vector implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(VectorDriver) -# Define source files -set(SRC driver.cpp) -# Build an executable -add_executable(TemplatedVectorDriver ${SRC}) +project ( + #[[NAME]] TemplatedVector + VERSION 1.0 + DESCRIPTION "A project for practicing templated Vector implementations" + LANGUAGES CXX +) + +add_executable(data-templates-vectors driver.cpp) diff --git a/cpp/datastructs/vector/CMakeLists.txt b/cpp/datastructs/vector/CMakeLists.txt index 5bec645..0f931c1 100644 --- a/cpp/datastructs/vector/CMakeLists.txt +++ b/cpp/datastructs/vector/CMakeLists.txt @@ -1,17 +1,21 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A basic CMakeLists configuration to test Vector implementation ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -## vector.cpp -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A basic CMakeLists configuration to test Vector implementation ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) -# Define the project name -project(VectorDriver) -# Define source files -set(SRC driver.cpp vector.cpp) -# Build an executable -add_executable(VectorDriver ${SRC}) +project ( + #[[NAME]] VectorDriver + VERSION 1.0 + DESCRIPTION "A project for testing a basic Vector implementation" + LANGUAGES CXX +) + +add_executable( + data-vectors driver.cpp + vector.cpp vector.h +) diff --git a/cpp/graphics/CMakeLists.txt b/cpp/graphics/CMakeLists.txt index d1e9ab3..bcbfeda 100644 --- a/cpp/graphics/CMakeLists.txt +++ b/cpp/graphics/CMakeLists.txt @@ -1,13 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A root project for practicing C++ ## -## This project can be built to debug and run all nested projects ## -## Or, any subdirectory with a project() statement can be selected ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## About: A root project for practicing C++ ## +## This project can be built to debug and run all nested projects ## +## Or, any subdirectory with a project() statement can be selected ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project( diff --git a/cpp/graphics/opengl-cmake/CMakeLists.txt b/cpp/graphics/opengl-cmake/CMakeLists.txt index 06b9956..6ea63ef 100644 --- a/cpp/graphics/opengl-cmake/CMakeLists.txt +++ b/cpp/graphics/opengl-cmake/CMakeLists.txt @@ -1,10 +1,9 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ # Define CMake version cmake_minimum_required(VERSION 3.15) @@ -15,15 +14,15 @@ project( LANGUAGES CXX ) -add_library(lib-opengl-test "src/lib-opengl-test.cpp") -target_include_directories(lib-opengl-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) +add_library(graphics-lib-opengl src/lib-opengl-test.cpp) +target_include_directories(graphics-lib-opengl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) # Find OpenGL package find_package(OpenGL REQUIRED) if (OPENGL_FOUND) # Link opengl-test executable to OpenGL - target_include_directories(lib-opengl-test PUBLIC ${OPENGL_INCLUDE_DIR}) - target_link_libraries(lib-opengl-test PUBLIC ${OPENGL_LIBRARIES}) + target_include_directories(graphics-lib-opengl PUBLIC ${OPENGL_INCLUDE_DIR}) + target_link_libraries(graphics-lib-opengl PUBLIC ${OPENGL_LIBRARIES}) else() message( "Error: CMake was unable to find the OpenGL package\n" @@ -35,8 +34,8 @@ endif() find_package(GLUT REQUIRED) if (GLUT_FOUND) # Link lib-opengl-test executable to GLUT - target_include_directories(lib-opengl-test PUBLIC ${GLUT_INCLUDE_DIR}) - target_link_libraries(lib-opengl-test PUBLIC ${GLUT_LIBRARIES}) + target_include_directories(graphics-lib-opengl PUBLIC ${GLUT_INCLUDE_DIR}) + target_link_libraries(graphics-lib-opengl PUBLIC ${GLUT_LIBRARIES}) else() message( "Error: CMake was unable to find the GLUT package\n" @@ -45,6 +44,6 @@ else() endif() # Add test executable -add_executable(opengl-test "apps/test-gl.cpp") -target_link_libraries(opengl-test PRIVATE lib-opengl-test) -target_include_directories(opengl-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) +add_executable(graphics-cmake-opengl apps/test-gl.cpp) +target_link_libraries(graphics-cmake-opengl PRIVATE graphics-lib-opengl) +target_include_directories(graphics-cmake-opengl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) diff --git a/cpp/graphics/sdl-cmake/CMakeLists.txt b/cpp/graphics/sdl-cmake/CMakeLists.txt index b0df5e3..6ee0d07 100644 --- a/cpp/graphics/sdl-cmake/CMakeLists.txt +++ b/cpp/graphics/sdl-cmake/CMakeLists.txt @@ -1,10 +1,9 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ # Define CMake version cmake_minimum_required(VERSION 3.15) @@ -17,16 +16,15 @@ project( # Add Library add_library( - lib-sdl-test # Library Name - "src/lib-sdl-test.cpp" # Sources.. - "src/lib-sdl-test.h" + graphics-lib-sdl # Library Name + src/lib-sdl-test.cpp src/lib-sdl-test.h # Sources.. ) target_include_directories( # When calling library, include a directory - lib-sdl-test # Library name + graphics-lib-sdl # Library name PUBLIC # Visibility - "${CMAKE_CURRENT_SOURCE_DIR}/src" # Source directory for library - ) + ${CMAKE_CURRENT_SOURCE_DIR}/src # Source directory for library +) # Search for SDL2 package find_package(SDL2 REQUIRED sdl2) @@ -35,20 +33,20 @@ find_package(SDL2 REQUIRED sdl2) if (SDL2_FOUND) # Any target that links with this library will also link to SDL2 # + Because we choose PUBLIC visibility - target_include_directories(lib-sdl-test PUBLIC ${SDL2_INCLUDE_DIRS}) - target_link_libraries(lib-sdl-test PUBLIC "${SDL2_LIBRARIES}") + target_include_directories(graphics-lib-sdl PUBLIC ${SDL2_INCLUDE_DIRS}) + target_link_libraries(graphics-lib-sdl PUBLIC "${SDL2_LIBRARIES}") # Creating executable add_executable( - sdl-test # Exe name - "apps/sdl-test.cpp" # Exe Source(s) + graphics-cmake-sdl # Exe name + apps/sdl-test.cpp # Exe Source(s) ) # Linking the exe to library target_link_libraries( - sdl-test # Executable to link + graphics-cmake-sdl # Executable to link PRIVATE # Visibility - lib-sdl-test # Library to link + graphics-lib-sdl # Library to link ) else() diff --git a/cpp/patterns/CMakeLists.txt b/cpp/patterns/CMakeLists.txt index 714492f..8660e29 100644 --- a/cpp/patterns/CMakeLists.txt +++ b/cpp/patterns/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing C++ design patterns ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing C++ design patterns ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project( diff --git a/cpp/patterns/abstract-factory/CMakeLists.txt b/cpp/patterns/abstract-factory/CMakeLists.txt index 195b628..9d1d96c 100644 --- a/cpp/patterns/abstract-factory/CMakeLists.txt +++ b/cpp/patterns/abstract-factory/CMakeLists.txt @@ -15,7 +15,8 @@ project( ) add_compile_options("-Wall") -add_library(abstract-parts "parts.cpp") -add_library(abstract-factory "factory.cpp") -add_executable(abstract-factory-test "main.cpp") -target_link_libraries(abstract-factory-test abstract-factory abstract-parts) +add_executable( + patterns-abstract-factory main.cpp + parts.cpp parts.hpp + abstract-factory.cpp abstract-factory.hpp +) diff --git a/cpp/patterns/abstract-factory/factory.cpp b/cpp/patterns/abstract-factory/abstract-factory.cpp similarity index 100% rename from cpp/patterns/abstract-factory/factory.cpp rename to cpp/patterns/abstract-factory/abstract-factory.cpp diff --git a/cpp/patterns/adapter/CMakeLists.txt b/cpp/patterns/adapter/CMakeLists.txt index 9f9cd6a..44f80a5 100644 --- a/cpp/patterns/adapter/CMakeLists.txt +++ b/cpp/patterns/adapter/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the adapter C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the adapter C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Adapter VERSION 1.0 @@ -15,6 +16,7 @@ project( ) add_compile_options("-Wall") -add_library(adapter "adapter.cpp") -add_executable(adapter-test "main.cpp") -target_link_libraries(adapter-test adapter) +add_executable( + patterns-adapter main.cpp + adapter.cpp adapter.hpp +) diff --git a/cpp/patterns/bridge/CMakeLists.txt b/cpp/patterns/bridge/CMakeLists.txt index 119b1cf..270b039 100644 --- a/cpp/patterns/bridge/CMakeLists.txt +++ b/cpp/patterns/bridge/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the bridge C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the bridge C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Bridge VERSION 1.0 @@ -15,7 +16,8 @@ project( ) add_compile_options("-Wall") -add_library(abstraction "abstraction.cpp") -add_library(implementation "implementation.cpp") -add_executable(bridge-test "main.cpp") -target_link_libraries(bridge-test abstraction implementation) +add_executable( + patterns-bridge main.cpp + abstraction.cpp abstraction.hpp + implementation.cpp implementation.hpp +) diff --git a/cpp/patterns/factory/CMakeLists.txt b/cpp/patterns/factory/CMakeLists.txt index 4a1719a..6cd71f5 100644 --- a/cpp/patterns/factory/CMakeLists.txt +++ b/cpp/patterns/factory/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the factory C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the factory C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Factory VERSION 1.0 @@ -15,7 +16,8 @@ project( ) add_compile_options("-Wall") -add_library(parts "parts.cpp") -add_library(factory "factory.cpp") -add_executable(factory-test "main.cpp") -target_link_libraries(factory-test factory parts) +add_executable( + patterns-factory main.cpp + parts.cpp parts.hpp + factory.cpp abstract-factory.hpp +) diff --git a/cpp/patterns/factory/factory.hpp b/cpp/patterns/factory/abstract-factory.hpp similarity index 100% rename from cpp/patterns/factory/factory.hpp rename to cpp/patterns/factory/abstract-factory.hpp diff --git a/cpp/patterns/factory/factory.cpp b/cpp/patterns/factory/factory.cpp index d310c5d..1949df6 100644 --- a/cpp/patterns/factory/factory.cpp +++ b/cpp/patterns/factory/factory.cpp @@ -1,7 +1,7 @@ #include -#include "factory.hpp" +#include "abstract-factory.hpp" Part* GearFactory::requestPart() { // Create a new part diff --git a/cpp/patterns/factory/main.cpp b/cpp/patterns/factory/main.cpp index 39a04c4..0ad598a 100644 --- a/cpp/patterns/factory/main.cpp +++ b/cpp/patterns/factory/main.cpp @@ -4,7 +4,7 @@ #include #include -#include "factory.hpp" +#include "abstract-factory.hpp" int main(const int argc, const char * argv[]) { // Testing GearFactory diff --git a/cpp/patterns/observer/CMakeLists.txt b/cpp/patterns/observer/CMakeLists.txt index b538355..5ce6e97 100644 --- a/cpp/patterns/observer/CMakeLists.txt +++ b/cpp/patterns/observer/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the observer C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the observer C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Observer VERSION 1.0 @@ -15,6 +16,7 @@ project( ) add_compile_options("-Wall") -add_library(observer "observer.cpp") -add_executable(observer-test "main.cpp") -target_link_libraries(observer-test observer) +add_executable( + patterns-observer main.cpp + observer.cpp observer.hpp +) diff --git a/cpp/patterns/prototype/CMakeLists.txt b/cpp/patterns/prototype/CMakeLists.txt index d779585..48eefb2 100644 --- a/cpp/patterns/prototype/CMakeLists.txt +++ b/cpp/patterns/prototype/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the prototype C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the prototype C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Prototype VERSION 1.0 @@ -15,6 +16,7 @@ project( ) add_compile_options("-Wall") -add_library(prototype "prototype.cpp") -add_executable(prototype-test "main.cpp") -target_link_libraries(prototype-test prototype) +add_executable( + patterns-prototype main.cpp + prototype.cpp prototype.hpp +) diff --git a/cpp/patterns/singleton/CMakeLists.txt b/cpp/patterns/singleton/CMakeLists.txt index 15a66d2..95d85a0 100644 --- a/cpp/patterns/singleton/CMakeLists.txt +++ b/cpp/patterns/singleton/CMakeLists.txt @@ -1,11 +1,11 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the singleton C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the singleton C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) project( @@ -15,7 +15,8 @@ project( LANGUAGES CXX ) -add_library(singleton "singleton.cpp") -add_library(singleton-pointer "singleton-pointer.cpp") -add_executable(singleton-test "main.cpp") -target_link_libraries(singleton-test singleton singleton-pointer) +add_executable( + patterns-singleton main.cpp + singleton-pointer.cpp singleton-pointer.hpp + singleton.cpp singleton.hpp +) diff --git a/cpp/patterns/singleton/singleton-pointer.hpp b/cpp/patterns/singleton/singleton-pointer.hpp index 1bdf682..0888cf4 100644 --- a/cpp/patterns/singleton/singleton-pointer.hpp +++ b/cpp/patterns/singleton/singleton-pointer.hpp @@ -19,7 +19,13 @@ private: ClassicSingleton(){ message = "New ClassicSingleton\n";} // Do not allow copying of this object ClassicSingleton(const ClassicSingleton&){} + // Ignore -Wreturn-type warnings; It's intentional for this pattern +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wreturn-type" ClassicSingleton& operator=(const ClassicSingleton&){} + // Unmatched pop reverts GCC to commandline options +#pragma GCC diagnostic pop +#pragma GCC diagnostic pop // Static pointer to instance of this singleton static ClassicSingleton* instance; diff --git a/cpp/patterns/singleton/singleton.hpp b/cpp/patterns/singleton/singleton.hpp index 383febc..2d64192 100644 --- a/cpp/patterns/singleton/singleton.hpp +++ b/cpp/patterns/singleton/singleton.hpp @@ -17,9 +17,15 @@ private: std::string message; // Don't allow copying of this class + // Ignore -Wreturn-type warnings; It's intentional for this pattern +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wreturn-type" Singleton() { message = "New singleton\n";} Singleton(const Singleton &) {} Singleton &operator=(const Singleton &) {} + // Unmatched pop reverts GCC to commandline options +#pragma GCC diagnostic pop +#pragma GCC diagnostic pop }; #endif // SINGLETON_H diff --git a/cpp/patterns/state/CMakeLists.txt b/cpp/patterns/state/CMakeLists.txt index 70adfbb..80aeae3 100644 --- a/cpp/patterns/state/CMakeLists.txt +++ b/cpp/patterns/state/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the state C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the state C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] State VERSION 1.0 @@ -15,6 +16,7 @@ project( ) add_compile_options("-Wall") -add_library(state "state.cpp") -add_executable(state-test "main.cpp") -target_link_libraries(state-test state) +add_executable( + patterns-state main.cpp + state.cpp state.hpp +) diff --git a/cpp/patterns/visitor/CMakeLists.txt b/cpp/patterns/visitor/CMakeLists.txt index ccb6067..9f4cb0d 100644 --- a/cpp/patterns/visitor/CMakeLists.txt +++ b/cpp/patterns/visitor/CMakeLists.txt @@ -1,12 +1,13 @@ -############################################################################### -## Author: Shaun Reed ## -## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ## -## About: A project for practicing the visitor C++ design pattern ## -## ## -## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## -############################################################################## -# +################################################################################ +## Author: Shaun Reed ## +## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ## +## About: A project for practicing the visitor C++ design pattern ## +## ## +## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## +################################################################################ + cmake_minimum_required(VERSION 3.15) + project( #[[NAME]] Visitor VERSION 1.0 @@ -15,6 +16,7 @@ project( ) add_compile_options("-Wall") -add_library(visitor "visitor.cpp") -add_executable(visitor-test "main.cpp") -target_link_libraries(visitor-test visitor) +add_executable( + patterns-visitor main.cpp + visitor.cpp visitor.hpp +)