Add unit test and fix for non-char types.

This commit is contained in:
King_DuckZ 2018-10-13 00:44:38 +01:00
parent 63cbf324ef
commit 4eb4209409
3 changed files with 65 additions and 5 deletions

View file

@ -51,13 +51,13 @@ namespace dhandy {
constexpr V to() const { return V(data(), size() - (not empty() and not back() ? 1 : 0)); }
#if !defined(INT_CONV_WITHOUT_HELPERS)
constexpr std::string_view to_string_view() const { return to<std::string_view>(); }
bool operator== (const std::string_view& other) const { return to_string_view() == other; }
bool operator!= (const std::string_view& other) const { return not operator==(other); }
constexpr std::basic_string_view<T> to_string_view() const { return to<std::basic_string_view<T>>(); }
bool operator== (const std::basic_string_view<T>& other) const { return to_string_view() == other; }
bool operator!= (const std::basic_string_view<T>& other) const { return not operator==(other); }
bool operator== (const std::string& other) const { return to_string_view() == other; }
bool operator!= (const std::string& other) const { return not operator==(other); }
bool operator== (const char* other) const { return to_string_view() == std::string_view(other); }
bool operator!= (const char* other) const { return not operator==(other); }
bool operator== (const T* other) const { return to_string_view() == std::basic_string_view<T>(other); }
bool operator!= (const T* other) const { return not operator==(other); }
#endif
private: