What to C++ 11 features to cover in my C++ courses?

Discussion in 'C++' started by bobl0456@gmail.com, Oct 22, 2013.

  1. Guest

    Hi folks,

    I am finally covering some of the new C++ features in my C++ course. I am interested in getting input from the C++ community as to the priority of new features to cover.

    To give you some idea of the features I am planning to cover, these are some of the new features I plan to cover:

    array container
    auto for type inference
    delegating ctors
    explicit conversion operators
    final classes
    final member functions
    inheriting base class ctors
    list initialization changes
    move assignment operator
    move ctor
    non-deterministic random number generation
    nullptr
    override keyword
    range based for statement
    regular expressions
    rvalue references
    scoped enums
    shared_ptr smart pointer
    unique_ptr smart pointer
    weak_ptr smart pointer

    I would appreciate advice on additional features I should cover and any of the above features you feel are unimportant.

    TIA
    Bob
    , Oct 22, 2013
    #1
    1. Advertising

  2. On 22.10.2013 05:18, wrote:
    > Hi folks,
    >
    > I am finally covering some of the new C++ features in my C++ course. I am interested in getting input from the C++ community as to the priority of new features to cover.
    >
    > To give you some idea of the features I am planning to cover, these are some of the new features I plan to cover:
    >
    > array container
    > auto for type inference
    > delegating ctors
    > explicit conversion operators
    > final classes
    > final member functions
    > inheriting base class ctors
    > list initialization changes
    > move assignment operator
    > move ctor
    > non-deterministic random number generation
    > nullptr
    > override keyword
    > range based for statement
    > regular expressions
    > rvalue references
    > scoped enums
    > shared_ptr smart pointer
    > unique_ptr smart pointer
    > weak_ptr smart pointer
    >
    > I would appreciate advice on additional features I should cover and any of the above
    > features you feel are unimportant.


    The students should already be familiar with shared_ptr from their
    experience with C++03, using boost::shared_ptr and/or the TR1 shared_ptr.

    If not then you need to cover that first, it's C++03 stuff.

    Then unique_ptr (pure C++11) as replacement for now deprecated auto_ptr.

    That covers the most important FUNCTIONAL CHANGES of the language, how
    to manage dynamically allocated objects.

    Then, considering what I use most,

    1. "auto" (especially for function declarations and constants),

    2. rvalue references and move semantics with std::move, move
    constructors and move assignment, and new conventions for argument
    passing (by value is often very OK) and function results (not const)

    3. std::function and lambdas


    I use range-based loops all the time but if you have to choose, then as
    above.

    As a general guideline, use the teaching time on what the students need
    to understand and can benefit from discussing, don't waste that time on
    what they can simply read up in Wikipedia, blogs and the holy Standard
    -- or MSDN Library -- even if a buzzword checklist might impress. ;-)


    Cheers & hth.,

    - Alf
    Alf P. Steinbach, Oct 22, 2013
    #2
    1. Advertising

  3. Guest

    On Monday, October 21, 2013 10:18:23 PM UTC-5, wrote:
    > Hi folks,
    >
    >
    >
    > I am finally covering some of the new C++ features in my C++ course. I am interested in getting input from the C++ community as to the priority of new features to cover.
    >
    >
    >
    > To give you some idea of the features I am planning to cover, these are some of the new features I plan to cover:
    >
    >
    >
    > array container
    > auto for type inference
    > delegating ctors
    > list initialization changes
    > move assignment operator
    > move ctor
    > nullptr
    > range based for statement
    > rvalue references
    > scoped enums
    > unique_ptr smart pointer
    >


    I use the above and also use non-static data member
    initialization. I haven't come across the need for
    shared_ptr. I haven't used explicit conversion
    operator's, but am interested in learning about
    that.

    Brian
    Ebenezer Enterprises - In G-d we trust.
    http://webEbenezer.net
    , Oct 22, 2013
    #3
  4. K. Frank Guest

    Hi Bob!

    On Monday, October 21, 2013 11:18:23 PM UTC-4, bobl...@...l.com wrote:
    > Hi folks,
    >
    > I am finally covering some of the new C++ features in my C++ course.
    > I am interested in getting input from the C++ community as to the
    > priority of new features to cover.


    First off, without knowing more about the context of your
    course -- purpose, length, students' previous programming
    experience, students' previous c++ experience -- it's hard
    to give appropriate advice.

    Also, it sounds like you're already well along in your course
    and coming up to the c++11 section, so my answer is probably
    too late.

    But I would turn things around and just teach c++11 as c++,
    and use various c++ features (including c++11 features) as
    appropriate. The c++11 standard was ratified already a couple
    of years ago, and largely complete drafts and compilers
    supporting much of the new functionality were available
    already a couple of years before that, so c++11 should hardly
    be looked upon as some mysterious bleeding edge thing.

    Quoting Stroustrup in his c++11 faq:

    What do you think of C++11?

    That's a (to me) amazingly frequent question. It may
    be the most frequently asked question. Surprisingly,
    C++11 feels like a new language: The pieces just fit
    together better than they used to and I find a higher-
    level style of programming more natural than before
    and as efficient as ever.

    (Of course, he's a partisan.)

    Although they might be considered syntactic sugar, a lot of
    c++11 features are there to make programming more convenient
    on a routine, day-to-day basis. (I'm thinking of things
    like auto, range-for, in-class initialization, uniform and
    list initialization, etc.)

    If we as a community continue to adopt cleaner, better c++11
    idioms as opportunity permits, and encourage our colleagues
    (and students) to do the same, the language in the field
    will get -- well -- cleaner and better.

    And what better place to start than in a c++ class.

    So rather than teach students -- I won't call them bad,
    but rather less-good -- pre-c++11 habits and then tack
    on some c++11 features at the end of the course, why not
    just teach c++11 best practices from day one?

    I recognize that some will argue that a lot of real-world
    c++ is pre-c++11, but a lot of real-world code is java,
    and python, and c. So I say why not teach your student
    the best, cleanest programming style and idioms, making
    use of language features (whether c++11 or not) that
    support that style and those idioms, even as we recognize
    that students will come across, and sometimes need to work
    with, other programming styles, dialects, and languages.

    That's my perspective, at least, although it may not be
    appropriate for the context and purpose of your specific
    class.

    > ...
    > TIA
    >
    > Bob



    Good luck.


    K. Frank
    K. Frank, Oct 22, 2013
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dani
    Replies:
    3
    Views:
    375
    Robert Smith
    Jul 16, 2005
  2. Jonathan Mcdougall
    Replies:
    2
    Views:
    478
    Kaz Kylheku
    Nov 3, 2005
  3. BillJosephson
    Replies:
    148
    Views:
    2,558
    peter koch
    Jan 27, 2007
  4. puzzlecracker
    Replies:
    4
    Views:
    941
    Richard
    Oct 19, 2009
  5. Xah Lee
    Replies:
    0
    Views:
    498
    Xah Lee
    Jul 31, 2010
Loading...

Share This Page