Compare commits

...

5 commits

Author SHA1 Message Date
Imbus
eb41bede5e Mass reformat 2025-01-11 17:54:29 +01:00
Imbus
c55321e6f1 Fix formatting target 2025-01-11 17:54:08 +01:00
Imbus
b5bb0bc2ca Yeet unused stuff 2025-01-11 17:53:00 +01:00
Imbus
022dffc9a4 Template 2025-01-11 17:52:26 +01:00
Imbus
0a18980aa3 Template fix 2025-01-11 17:52:09 +01:00
13 changed files with 115 additions and 131 deletions

View file

@ -18,7 +18,7 @@ clean:
done done
format: format:
find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.c" \) -exec clang-format -i {} \; find . -type f \( -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.c" \) -exec clang-format -i {} \;
.PHONY: build clean test format .PHONY: build clean test format

View file

@ -4,16 +4,16 @@ using std::cout;
// Rule of three: // Rule of three:
// If a class requires a user-defined destructor, a user-defined copy // If a class requires a user-defined destructor, a user-defined copy
// constructor, or a user-defined copy assignment operator, it almost certainly // constructor, or a user-defined copy assignment operator, it almost
// requires all three. // certainly requires all three.
// //
// Rule of five: // Rule of five:
// Because the presence of a user-defined (include = default or = delete // Because the presence of a user-defined (include = default or = delete
// declared) destructor, copy-constructor, or copy-assignment operator prevents // declared) destructor, copy-constructor, or copy-assignment operator
// implicit definition of the move constructor and the move assignment operator, // prevents implicit definition of the move constructor and the move
// any class for which move semantics are desirable, has to declare all five // assignment operator, any class for which move semantics are desirable, has
// special member functions: // to declare all five special member functions:
struct A { struct A {
A() = default; A() = default;

View file

@ -14,6 +14,4 @@ void use2() {
consume_number(&i); consume_number(&i);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) { use2(); }
use2();
}

View file

@ -1,6 +1,6 @@
#include <iostream> #include <iostream>
#include <vector>
#include <ranges> #include <ranges>
#include <vector>
template <typename InputIt, typename OutputIt, typename Pred> template <typename InputIt, typename OutputIt, typename Pred>
std::pair<InputIt, OutputIt> copy_while(InputIt first, InputIt last, std::pair<InputIt, OutputIt> copy_while(InputIt first, InputIt last,

View file

@ -2,7 +2,7 @@
template <typename T> class User { template <typename T> class User {
T id; T id;
public: public:
explicit User(T n) : id(n) {} explicit User(T n) : id(n) {}
}; };

5
template/Makefile Normal file
View file

@ -0,0 +1,5 @@
# Only define if needed:
# TARGET = main.elf
# SRCS = main.cc
include ../config.mk

3
template/main.cc Normal file
View file

@ -0,0 +1,3 @@
#include <iostream>
int main() { std::cout << "Template" << std::endl; }

View file

@ -1,6 +0,0 @@
TARGET = main.elf
SRCS = main.cc
all: $(TARGET)
include ../config.mk

View file

@ -1,5 +0,0 @@
#include <iostream>
int main() {
std::cout << "Hola" << std::endl;
}

View file

@ -1,6 +0,0 @@
TARGET = main.elf
SRCS = main.cc
all: $(TARGET)
include ../config.mk

View file

@ -1,5 +0,0 @@
#include <iostream>
int main() {
std::cout << "Hola" << std::endl;
}