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 6029661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:55:11+00:00 2026-05-23T04:55:11+00:00

I would like to enable support for C++0x in GCC with -std=c++0x . I

  • 0

I would like to enable support for C++0x in GCC with -std=c++0x. I don’t absolutely necessarily need any of the currently supported C++11 features in GCC 4.5 (and soon 4.6), but I would like to start getting used to them. For example, in a few places where I use iterators, an auto type would be useful.

But again, I don’t need any of the currently supported features. The goal here is to encourage me to incorporate the features of the new standard into my programming “vocabulary”.

From what you know of the C++11 support, is it a good idea to enable it in GCC, and then embrace it by, for example, switching from using boost::shared_ptr to std::shared_ptr exclusively as the two don’t mix?

PS: I’m aware of this good question which compares the different flavors of shared_ptr but I’m asking a higher level advice on which to use before the standard is finalized. Another way of putting that is, when a compiler like GCC says it supports an “experimental feature”, does that mean I am likely to encounter weird errors during compilation that will be major time sinks and a source of cryptic questions on StackOverflow?

Edit: I decided to switch back from std::shared_ptr because I just don’t trust its support in GCC 4.5 as shown by example in this question.

  • 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-05-23T04:55:12+00:00Added an answer on May 23, 2026 at 4:55 am

    There are a couple of reasons to switch over to std::shared_ptr:

    • You remove a dependency on Boost.
    • Debuggers. Depending on your compiler and debugger, the debugger may be “smart” about std::shared_ptr and show the pointed to object directly, where it wouldn’t for say, boost’s implementation. At least in Visual Studio, std::shared_ptr looks like a plain pointer in the debugger, while boost::shared_ptr exposes a bunch of boost’s innards.
    • Other new features defined in your linked question.
    • You get an implementation which is almost guaranteed to be move-semantics enabled, which might save a few refcount modifications. (Theoretically — I’ve not tested this myself) As of 2014-07-22 at least, boost::shared_ptr understands move semantics.
    • std::shared_ptr correctly uses delete [] on array types, while boost::shared_ptr causes undefined behavior in such cases (you must use shared_array or a custom deleter) (Actually I stand corrected. See this — the specialization for this is for unique_ptr only, not shared_ptr.)

    And one major glaring reason not to:

    • You’d be limiting yourself to C++11 compiler and standard library implementations.

    Finally, you don’t really have to choose. (And if you’re targeting a specific compiler series (e.g. MSVC and GCC), you could easily extend this to use std::tr1::shared_ptr when available. Unfortunately there doesn’t seem to be a standard way to detect TR1 support)

    #if __cplusplus > 199711L
    #include <memory>
    namespace MyProject
    {
        using std::shared_ptr;
    }
    #else
    #include <boost/shared_ptr.hpp>
    namespace MyProject
    {
        using boost::shared_ptr;
    }
    #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to support Java 1.5+ in my application, but selectively enable features
I would like to enable/disable some code based on a custom solution configuration I
I would like to enable users of my application to define a number of
I have a UITextField that I would like to enable auto completion on by:
I have a WPF ListBox that I would like to Enable multiple selection in
Would like to create a strong password in C++. Any suggestions? I assume it
We have several Visual Studio projects, and we would like to: enable/disable some defines
Would like to get a list of advantages and disadvantages of using Stored Procedures.
Would like to be able to set colors of headings and such, different font
Would like to know what a programmer should know to become a good at

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.