52

Вопрос по stl, stdstring, c++ – std :: string :: c_str () и временные

Error: User Rate Limit Exceeded

void consumer(char const* p)
{
  std::printf("%s", p);
}

std::string random_string_generator()
{
  // returns a random std::string object
}

consumer(random_string_generator().c_str());

Error: User Rate Limit Exceeded

  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded§ 12.2 ... Temporary objects are destroyed as the last step in evaluating the full-expression (1.9) that (lexically) contains the point where they were created. This is true even if that evaluation ends in throwing an exception.

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от user1095108
  • 5

    Error: User Rate Limit Exceeded

  • 66

    Error: User Rate Limit Exceeded

    std::string::c_str()consumerconsumer

    std::string

  • 18

    Error: User Rate Limit Exceeded

    std::stringconsumerdirectly from within consumernotc_str