fix build
This commit is contained in:
parent
00a333bb8e
commit
f14c1b5065
2 changed files with 19 additions and 15 deletions
|
@ -879,16 +879,16 @@ string nameof_full_type_rtti(const char* tn) {
|
|||
free(dmg);
|
||||
assert(name.size() > 0 && "Type does not have a name.");
|
||||
if constexpr (std::is_const_v<std::remove_reference_t<T>>) {
|
||||
name = "const " + name;
|
||||
name = string{"const "}.append(name);
|
||||
}
|
||||
if constexpr (std::is_volatile_v<std::remove_reference_t<T>>) {
|
||||
name = "volatile " + name;
|
||||
name = string{"volatile "}.append(name);
|
||||
}
|
||||
if constexpr (std::is_lvalue_reference_v<T>) {
|
||||
name += '&';
|
||||
name.append(1, '&');
|
||||
}
|
||||
if constexpr (std::is_rvalue_reference_v<T>) {
|
||||
name += "&&";
|
||||
name.append("&&");
|
||||
}
|
||||
|
||||
return name;
|
||||
|
@ -898,7 +898,8 @@ template <typename T, enable_if_has_short_name_t<T, int> = 0>
|
|||
string nameof_short_type_rtti(const char* tn) {
|
||||
static_assert(nameof_type_rtti_supported<T>::value, "nameof::nameof_type_rtti unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility).");
|
||||
const auto dmg = abi::__cxa_demangle(tn, nullptr, nullptr, nullptr);
|
||||
const auto name = string{pretty_name(dmg)};
|
||||
const auto pname = pretty_name(dmg);
|
||||
const auto name = string{pname.data(), pname.size()};
|
||||
free(dmg);
|
||||
assert(name.size() > 0 && "Type does not have a short name.");
|
||||
|
||||
|
@ -920,16 +921,16 @@ string nameof_full_type_rtti(const char* tn) noexcept {
|
|||
auto name = string{tn};
|
||||
assert(name.size() > 0 && "Type does not have a name.");
|
||||
if constexpr (std::is_const_v<std::remove_reference_t<T>>) {
|
||||
name = "const " + name;
|
||||
name = string{"const "}.append(name);
|
||||
}
|
||||
if constexpr (std::is_volatile_v<std::remove_reference_t<T>>) {
|
||||
name = "volatile " + name;
|
||||
name = string{"volatile "}.append(name);
|
||||
}
|
||||
if constexpr (std::is_lvalue_reference_v<T>) {
|
||||
name += '&';
|
||||
name.append(1, '&');
|
||||
}
|
||||
if constexpr (std::is_rvalue_reference_v<T>) {
|
||||
name += "&&";
|
||||
name.append("&&");
|
||||
}
|
||||
|
||||
return name;
|
||||
|
|
|
@ -28,14 +28,16 @@
|
|||
|
||||
struct MyString {
|
||||
MyString() : str{} {} // required
|
||||
MyString(const char* s) : str{s} {} // required
|
||||
MyString(const char* s, std::size_t l) : str{s, l} {} // required
|
||||
bool empty() const { return str.empty(); } // required
|
||||
std::size_t size() const { return str.size(); } // required
|
||||
auto begin() const { return str.begin(); } // required
|
||||
auto end() const { return str.end(); } // required
|
||||
void append(std::size_t count, char c) { str.append(count, c); } // required
|
||||
void append(const char* s, std::size_t size) { str.append(s, size); } // required
|
||||
MyString& append(std::size_t count, char c) { str.append(count, c); return *this; } // required
|
||||
MyString& append(const char* s) { str.append(s); return *this; } // required
|
||||
MyString& append(const MyString& s) { str.append(s.str); return *this; } // required
|
||||
|
||||
std::size_t size() const { return str.size(); }
|
||||
int compare(const char* s) const { return str.compare(s); }
|
||||
|
||||
private:
|
||||
|
@ -47,7 +49,8 @@ struct MyStringView {
|
|||
static constexpr auto npos = std::string_view::npos; // required
|
||||
|
||||
constexpr MyStringView() : str{} {} // required
|
||||
constexpr MyStringView(const char* cstr, std::size_t size) : str{cstr, size} {} // required
|
||||
constexpr MyStringView(const char* s) : str{s} {} // required
|
||||
constexpr MyStringView(const char* s, std::size_t size) : str{s, size} {} // required
|
||||
constexpr bool empty() const { return str.empty(); } // required
|
||||
constexpr std::size_t size() const { return str.size(); } // required
|
||||
constexpr const char* data() const { return str.data(); } // required
|
||||
|
@ -57,10 +60,10 @@ struct MyStringView {
|
|||
constexpr std::size_t find(char c) const { return str.find(c); } // required
|
||||
constexpr MyStringView substr(std::size_t p, std::size_t n) { return str.substr(p, n); } // required
|
||||
constexpr void remove_prefix(std::size_t n) { str.remove_prefix(n); } // required
|
||||
constexpr int compare(MyStringView s) const { return str.compare(s); } // required
|
||||
constexpr void remove_suffix(std::size_t n) { str.remove_suffix(n); } // required
|
||||
constexpr int compare(MyStringView s) const { return str.compare(s.str); } // required
|
||||
friend constexpr bool operator==(MyStringView lhs, MyStringView rhs); // required
|
||||
|
||||
constexpr MyStringView(const char* cstr) : str{ cstr } {}
|
||||
constexpr int compare(const char* s) const { return str.compare(s); }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue