From a4220e3c0de22e0f3dc51f152f46f3a34d55bcb8 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 8 Dec 2023 20:11:58 -0500 Subject: [PATCH] test --- include/blt/std/utility.h | 59 ++++++++++++++++++++++++-------------- tests/src/utility_test.cpp | 5 ++++ 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/include/blt/std/utility.h b/include/blt/std/utility.h index 1a37de8..04e55d3 100644 --- a/include/blt/std/utility.h +++ b/include/blt/std/utility.h @@ -22,42 +22,57 @@ #include #if defined(__GNUC__) + #include #include #include - namespace blt +namespace blt +{ + static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) { - static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) - { - int status; - // only defined for GNU C++11? - char* demangled_name = abi::__cxa_demangle(str.c_str(), nullptr, nullptr, &status); - if (demangled_name == nullptr) - return str; - std::string ret_name = demangled_name; - std::free(demangled_name); - return ret_name; - } - } -#else - namespace blt - { - static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) - { + int status; + // only defined for GNU C++11? + char* demangled_name = abi::__cxa_demangle(str.c_str(), nullptr, nullptr, &status); + if (demangled_name == nullptr) return str; - } + std::string ret_name = demangled_name; + std::free(demangled_name); + return ret_name; } +} +#else +namespace blt +{ + static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) + { + return str; + } +} #endif namespace blt { - - template + template class enumerate { private: - + size_t index = 0; + TYPE_ITR begin; + TYPE_ITR end; + public: + class enumerate_itr + { + public: + using iterator_category = std::input_iterator_tag; + using value_type = typename TYPE_ITR::value_type; + using difference_type = typename TYPE_ITR::difference_type; + using pointer = typename TYPE_ITR::pointer; + using reference = typename TYPE_ITR::reference; + private: + size_t index = 0; + public: + }; }; #if defined(__GNUC__) || defined(__llvm__) diff --git a/tests/src/utility_test.cpp b/tests/src/utility_test.cpp index eebf876..f1ceb9a 100644 --- a/tests/src/utility_test.cpp +++ b/tests/src/utility_test.cpp @@ -36,6 +36,10 @@ void printLines(const std::vector& lines) std::cout << v << "\n"; } +void testEnumerate(const std::vector& test){ + +} + void getfucked(){ BLT_ASSERT(false); } @@ -65,6 +69,7 @@ void blt::test::utility::run() tableTest.addRow({"Sleeping Together (Sexual)", "10,000"}); tableTest.addRow({"Relationship (I would do anything for you)", "1,000,000,000,000"}); + testEnumerate(tableTest.createTable(true, true)); printLines(tableTest.createTable(true, true));