diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index 3811ea22dcc361bbf6ec06216694fce52261dff5..7ec7292d02569f17b1fee98df835d1170b600b45 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -249,6 +249,8 @@ public: template <size_t M> OPENDHT_PUBLIC friend std::istream& operator>> (std::istream& s, Hash<M>& h); + /** Returns view to thread-allocated memory, only valid until the next call to this function. */ + std::string_view to_view() const { return std::string_view(to_c_str(), N*2); } const char* to_c_str() const; std::string toString() const;