Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:09:21+00:00 2026-06-02T23:09:21+00:00

I have the following code: std::string HtmlToText( std::string const& html ) { boost::scoped_array<char> text(

  • 0

I have the following code:

std::string HtmlToText( std::string const& html )
{
    boost::scoped_array<char> text( converter.toText( html.c_str() ) );
    return text.get();
}

My concern with this code was whether or not object text would be destructed after text.get() returns but before the temporary return object std::string gets constructed. This would be a problem if it would be destructed at that time.

I searched around the C++03 standard for the rules and specifics on when to destruct objects in relation to the return statement in function scope, but I had no luck finding what I wanted. Can anyone help me find it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:09:23+00:00Added an answer on June 2, 2026 at 11:09 pm

    I don’t have the text of the C++03 draft at hand but I seem to recall that any temporary created from the call will be destructed before the actual text object is deleted (LIFO ordering of automatic objects in block scope) and this should guarantee that you never run into this issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: struct Message { explicit Message(const std::string& message) : selfMessage(message)
I have the following code: int MimeDocument::GetAttachmentId( std::string const& content_id ) { using namespace
I have the following code: template <class T> static std::string ToString(const T& t) {
I have the following code: void cStatisticDBSerializer::GetStats (std::map <std::string, long long >& ioCounterStats, std::map
I have the following code : std::string Utils::get() { std::string result; result.append(1, 'x'); result.append(1,
I have the following lines of code: if(std::binary_search(face_verts.begin(), face_verts.end(), left_right_vert[0]) && std::binary_search(face_verts.begin(), face_verts.end(), left_right_vert[1]))
I have the following code: int main(int argc, char** argv) { onelog a; std::cout
I have the following code: #include <string> #include <iostream> #include <tr1/unordered_map> typedef std::tr1::unordered_map<unsigned long
I have the following C++ code std::map<std::string, std::vector<std::vector<std::vector<double> > > > details details[string][index][index].push_back(123.5); May
I have following code and I cant figure out how to convert char string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.