From a4010b5b33a7c87a6cf0c3424018b1b991f21214 Mon Sep 17 00:00:00 2001 From: Mal Date: Sat, 8 Oct 2022 21:01:53 +0200 Subject: [PATCH] Init --- .gitignore | 1 + Makefile | 6 ++++++ template.cpp | 14 ++++++++++++++ wtf.cpp | 13 +++++++++++++ wtf.hpp | 15 +++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 template.cpp create mode 100644 wtf.cpp create mode 100644 wtf.hpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5761abc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.o diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f4bdf02 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +template: template.cpp wtf.o + g++ -o template template.cpp wtf.o + +wtf.o: wtf.cpp wtf.hpp + g++ -o wtf.o -c wtf.cpp + diff --git a/template.cpp b/template.cpp new file mode 100644 index 0000000..b775c71 --- /dev/null +++ b/template.cpp @@ -0,0 +1,14 @@ +#include +#include "wtf.hpp" + + +int main() +{ + int number = 42; + + Wtf wtf(number); + + std::cout << wtf.getTest() << std::endl; + + return 0; +} diff --git a/wtf.cpp b/wtf.cpp new file mode 100644 index 0000000..f0977ab --- /dev/null +++ b/wtf.cpp @@ -0,0 +1,13 @@ +#include "wtf.hpp" + + +template +Wtf::Wtf(T & test): test(test) +{ +} + +template +T & Wtf::getTest() +{ + return this->test; +} diff --git a/wtf.hpp b/wtf.hpp new file mode 100644 index 0000000..fa9b7cd --- /dev/null +++ b/wtf.hpp @@ -0,0 +1,15 @@ +#ifndef __WTF__ +#define __WTF__ + +template +class Wtf +{ + T & test; + + public: + Wtf(T & test); + + T & getTest(); +}; + +#endif