mdbx++: move to_string() inlines to std::.

Change-Id: I8d0ec1cd64f8a8c7da57c769255089a5fd969940
This commit is contained in:
Leonid Yuriev 2020-09-28 18:36:05 +03:00
parent 75e360b8b3
commit b13e9f01fc

View File

@ -4537,94 +4537,95 @@ inline int buffer<ALLOCATOR>::data_preserver::callback(void *context,
} }
} }
} // namespace mdbx
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline std::string to_string(const slice &value) { namespace std {
std::ostringstream out;
inline string to_string(const mdbx::slice &value) {
ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
template <class ALLOCATOR> template <class ALLOCATOR>
inline std::string to_string(const buffer<ALLOCATOR> &buffer) { inline string to_string(const mdbx::buffer<ALLOCATOR> &buffer) {
std::ostringstream out; ostringstream out;
out << buffer; out << buffer;
return out.str(); return out.str();
} }
inline std::string to_string(const pair &value) { inline string to_string(const mdbx::pair &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::geometry &value) { inline string to_string(const mdbx::env::geometry &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::operate_parameters &value) { inline string to_string(const mdbx::env::operate_parameters &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::mode &value) { inline string to_string(const mdbx::env::mode &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::durability &value) { inline string to_string(const mdbx::env::durability &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::reclaiming_options &value) { inline string to_string(const mdbx::env::reclaiming_options &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env::operate_options &value) { inline string to_string(const mdbx::env::operate_options &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const env_managed::create_parameters &value) { inline string to_string(const mdbx::env_managed::create_parameters &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const MDBX_log_level_t &value) { inline string to_string(const ::MDBX_log_level_t &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const MDBX_debug_flags_t &value) { inline string to_string(const ::MDBX_debug_flags_t &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const error &value) { inline string to_string(const mdbx::error &value) {
std::ostringstream out; ostringstream out;
out << value; out << value;
return out.str(); return out.str();
} }
inline std::string to_string(const ::MDBX_error_t &errcode) { inline string to_string(const ::MDBX_error_t &errcode) {
return to_string(error(errcode)); return to_string(mdbx::error(errcode));
} }
} // namespace mdbx
namespace std {
template <> struct hash<mdbx::slice> { template <> struct hash<mdbx::slice> {
MDBX_CXX14_CONSTEXPR size_t MDBX_CXX14_CONSTEXPR size_t
operator()(mdbx::slice const &slice) const noexcept { operator()(mdbx::slice const &slice) const noexcept {