Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > What to C++ 11 features to cover in my C++ courses?

Reply
Thread Tools

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

 
 
bobl0456@gmail.com
Guest
Posts: n/a
 
      10-22-2013
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

 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      10-22-2013
On 22.10.2013 05:18, http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
 
 
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      10-22-2013
On Monday, October 21, 2013 10:18:23 PM UTC-5, (E-Mail Removed) 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
 
Reply With Quote
 
K. Frank
Guest
Posts: n/a
 
      10-22-2013
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the advantage of using maven for java standalone app mcheung63@gmail.com Java 13 04-16-2013 01:42 AM
have you read emacs manual cover to cover?; (was Do we need a"Stevens" book?) Xah Lee Python 0 07-31-2010 05:47 AM
Which C++ books did you read cover-to-cover? puzzlecracker C++ 4 10-19-2009 08:49 PM
The Birth Of Thriller Cover chapter 4--The Album Cover HiBob Digital Photography 0 05-27-2008 07:58 AM
Plastic cover for 2.5 inch LCD [like the cover comes to protect LCD of some DSLR] zxcvar Digital Photography 0 12-28-2003 03:52 PM



Advertisments