test
parent
8defbaf70d
commit
a4220e3c0d
|
@ -22,42 +22,57 @@
|
|||
#include <optional>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#include <cxxabi.h>
|
||||
#include <blt/compatibility.h>
|
||||
#include <string>
|
||||
|
||||
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<typename BEGIN, typename END>
|
||||
template<typename TYPE_ITR>
|
||||
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__)
|
||||
|
|
|
@ -36,6 +36,10 @@ void printLines(const std::vector<std::string>& lines)
|
|||
std::cout << v << "\n";
|
||||
}
|
||||
|
||||
void testEnumerate(const std::vector<std::string>& 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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue