Favorite little known or underused C++ features

Started by
45 comments, last by SeraphLance 11 years, 6 months ago

[quote name='Joe the Objective C Lover' timestamp='1351030610' post='4993238']
[quote name='Washu' timestamp='1351029783' post='4993229']
Also, I like your nickname. It's much better...now that I've changed it.

rofl bah fix it!
[/quote]

Personally I liked "joew" seeing as it is the *ultimate* first name plus last initial.
[/quote]
Well, I was going to go for [Joe the:Objective c:Lover] but it wouldn't accept that.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Advertisement
Don't make me whine to Drew! ph34r.png

Don't make me whine to Drew! ph34r.png

Your wish has been granted. :D

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.


Your wish has been granted.

To joew!

EDIT: not funny!

[quote name='Washu' timestamp='1351031686' post='4993245']
Your wish has been granted.

To joew!
[/quote]

I'm CONFUSED?!?

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.


I'm CONFUSED?!?

So am I.... this change actually introduces a compile error for some wtf reason:

[source lang="cpp"]// Original
Rectangle& operator=(const Rectangle& rhs) : left(rhs.left), bottom(rhs.bottom), right(rhs.right), top(rhs.top) {}

// Replaced with
Rectangle& operator=(const Rectangle&) = default;
[/source]

EDIT: and yeah it's just a pod struct

[quote name='Washu' timestamp='1351031983' post='4993247']
I'm CONFUSED?!?

So am I.... this change actually introduces a compile error for some wtf reason:

[source lang="cpp"]// Original
Rectangle& operator=(const Rectangle& rhs) : left(rhs.left), bottom(rhs.bottom), right(rhs.right), top(rhs.top) {}

// Replaced with
Rectangle& operator=(const Rectangle&) = default;
[/source]

EDIT: and yeah it's just a pod struct
[/quote]

If you're going to do one assignment operator, you should do both (move and copy).

As an additional note: VS2012 does not support default nor deleted

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.


If you're going to do one assignment operator, you should do both (move and copy).

I do :)

As an additional note: VS2012 does not support default nor deleted

Gross! I'll stick with clang which has the majority of the standard in smile.png

EDIT: FYI the issue was just that another class using Rectangle didn't have operator= defined ... that's nice it makes it easy to track down during a cleaning day like today
I once used negative array indices in combination with a semi-Duff's Device - and winced in mixed horror/pride afterwards. But it was in the days when C-abuse like that used to please me (I've sinced learned).

Statements like this make me smile:
if ((time = (newtime = GetTime ()) - oldtime) > 0)

Wouldn't do it in real code, but it gets a "hey! you can do this!" comment in stuff I'm fooling around with.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement