Skip to content
Snippets Groups Projects
Commit aaeffce2 authored by Jaswant Panchumarti (Kitware)'s avatar Jaswant Panchumarti (Kitware)
Browse files

Support std::string_view in vtkOStreamWrapper

parent 232dd5b5
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,13 @@ vtkOStreamWrapper& vtkOStreamWrapper::operator<<(std_string const& s)
return *this;
}
//------------------------------------------------------------------------------
vtkOStreamWrapper& vtkOStreamWrapper::operator<<(std_string_view const& s)
{
this->ostr << reinterpret_cast<std::string_view const&>(s);
return *this;
}
//------------------------------------------------------------------------------
#if defined(__IBMCPP__)
vtkOStreamWrapper& vtkOStreamWrapper::WriteInternal(const char* a)
......
......@@ -33,6 +33,7 @@ class vtkStdString;
class VTKCOMMONCORE_EXPORT VTK_WRAPEXCLUDE vtkOStreamWrapper
{
class std_string;
class std_string_view;
public:
///@{
......@@ -114,6 +115,13 @@ public:
return *this;
}
// Accept std::string_view without a declaration.
template <template <typename, typename> class SV>
vtkOStreamWrapper& operator<<(const SV<char, std::char_traits<char>>& sv)
{
return *this << reinterpret_cast<std_string_view const&>(sv);
}
/**
* Forward the write method to the real stream.
*/
......@@ -155,6 +163,7 @@ protected:
private:
vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) = delete;
vtkOStreamWrapper& operator<<(std_string const&);
vtkOStreamWrapper& operator<<(std_string_view const&);
};
VTK_ABI_NAMESPACE_END
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment