From 5fbf41e967ed8e413ecf1e6abb72e8d285169df4 Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Fri, 24 May 2024 14:07:47 +0700 Subject: Pic + Tuple + refactor PrimaryInitialization class --- include/ISingleton.h | 12 +++++ include/Templates.h | 127 +++++++++++++++++++++++++++++++++++++++++++++ include/containers/Tuple.h | 98 ++++++++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+) create mode 100644 include/ISingleton.h create mode 100644 include/Templates.h create mode 100644 include/containers/Tuple.h (limited to 'include') diff --git a/include/ISingleton.h b/include/ISingleton.h new file mode 100644 index 0000000..1dcd0d1 --- /dev/null +++ b/include/ISingleton.h @@ -0,0 +1,12 @@ +#ifndef SINGLETON_H +#define SINGLETON_H + + +template +class ISingleton +{ + public: + virtual T *getInstance() = 0; +}; + +#endif diff --git a/include/Templates.h b/include/Templates.h new file mode 100644 index 0000000..8a1bd95 --- /dev/null +++ b/include/Templates.h @@ -0,0 +1,127 @@ +#ifndef TEMPLATES_H +#define TEMPLATES_H + + +#include + +template +struct constant +{ + static constexpr T value = val; + T& operator()() {return value;} +}; + +template +struct isSame +{ + using cnst = constant; + bool static inline constexpr val(){return cnst::value;}; + constexpr operator bool() const {return cnst::value;} + bool constexpr operator()() {return cnst::value;} +}; + +template +struct isSame +{ + using cnst = constant; + constexpr operator bool() const {return cnst::value;} + bool static inline constexpr val(){return cnst::value;}; + bool constexpr operator()() {return cnst::value;} +}; + +template +struct parametersOperations +{ + template + using first = Head; + + template + using tail = parametersOperations; + + // Append operation + template + struct append + { + using result = parametersOperations::template append::result; + }; + + template