error: incomplete type 'vtkOStreamWrapper::std_string' used in type trait expression

Hello, did anyone knows where is the definition of the forward declaration class std_string in tkOStreamWrapper.h. Then I can include this file to make the std_string complete. I have searched all the head files, didn’t fined any content relate to std_string. There is a file vtkStdString.h, but it’s not the std_string.

could anyone help me out.

Thank you very much.

So can you show us exactly what error you saw that was related to it?

As far as I understand, std_string is not intended to have a definition. It’s private, and only used as an opaque reference.

See this code in vtkOStreamWrapper.h:

  // Accept std::string without a declaration.
  template <template <typename, typename, typename> class S>
  vtkOStreamWrapper& operator<<(const S<char, std::char_traits<char>, std::allocator<char>>& s)
  {
    return *this << reinterpret_cast<std_string const&>(s);
  }

And see this code in vtkOStreamWrapper.cxx:

vtkOStreamWrapper& vtkOStreamWrapper::operator<<(std_string const& s)
{
  this->ostr << reinterpret_cast<std::string const&>(s);
  return *this;
}

As you can see, std_string is only used by reference, and it needs no definition. It’s just used with a bit of template magic to allow operator<< to work with std::string, without requiring vtkOStreamWrapper.h to do #include <string>.

The code has been this way (intentionally) for many years.