diff --git a/makefile b/makefile index 3116133..9554d96 100644 --- a/makefile +++ b/makefile @@ -36,7 +36,10 @@ HDRS := $(wildcard src/*.hpp) # Specify the object files in the build directory OBJS := $(patsubst src/%.cpp,build/%.o,$(SRCS)) +# Print green after success all: $(TARGET) + make size + @echo -e "\033[0;32m[Success]\033[0m" # For convenience run: $(TARGET) @@ -76,6 +79,10 @@ tar: $(TARGET_TAR) # Sign the tar sign: $(TARGET_SIG) +# Check the assembly +asm: $(TARGET) + $(OBJDUMP) -d $(TARGET) + $(TARGET_SIG): $(TARGET_TAR) minisign -Sm $< diff --git a/src/main.cpp b/src/main.cpp index 9e8bc6a..c51cec7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,25 @@ #include +#include #include "point.hpp" +template struct Option { + private: + T value; + bool is_some; + + public: + Option() : is_some(false) {} + Option(T value) : value(value), is_some(true) {} +}; + +// Templated alias for unique_ptr +template using Box = std::unique_ptr; + +template Box Enbox(Args &&...args) { + return std::make_unique(std::forward(args)...); +} + int main(int argc, char *argv[]) { Point p = Point(10, 5); std::cout << p << std::endl; @@ -13,7 +31,12 @@ int main(int argc, char *argv[]) { std::cout << "Distance is not the same" << std::endl; } + Box p_box = std::make_unique(10, 5); + Box p_box2 = Enbox(10, 5); + std::cout << p << std::endl; + std::cout << *p_box << std::endl; + std::cout << *p_box2 << std::endl; std::cout << "Hello, World!" << std::endl; return 0; }