commit a4010b5b33a7c87a6cf0c3424018b1b991f21214 Author: Mal Date: Sat Oct 8 21:01:53 2022 +0200 Init 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