Search code examples
c++stringcasablanca

no suitable user-defined conversion from utility::string_t to std::string


I am using the casablanca C++ Rest library to make HTTP requests.

The problem is that this gives a utility::string_t string as output and I can't quite find any way to convert this to a classic std::string. Any ideas?

client.request(methods::GET).then([](http_response response)
{
  if(response.status_code() == status_codes::OK)
  {
    string_t s = response.extract_string().get();
  }
});

Solution

  • If you see the documentation for C++ REST SDK from github, you'll find a typedef

    C++ Rest SDK - utility Namespace Reference

    typedef std::string     string_t;
    

    So no need to convert it. Both are same types.