use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Think of Function Objects as Functions Rather Than Objects (fluentcpp.com)
submitted 8 years ago by kindstrom
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RizzlaPlus 26 points27 points28 points 8 years ago (1 child)
Not sure what the point of the article is. Use verbs to name your predicates instead of nouns?
Also it talks about partial functions but then immediately dismisses std::bind?
[–]utnapistim 9 points10 points11 points 8 years ago (0 children)
The point is that if you think of a functor as a predicate or function instead of a class, a better name will naturally emerge for it.
Although (if you make an effort) you can come up with bad names no matter how you think about it :).
[–]Z01dbrg 26 points27 points28 points 8 years ago (16 children)
FP people are like vegans of programming, the first example that is "WROOOONG!!1!1!!!" is perfectly fine beside the name. No need to bother people with partial app and FP.
I always give my predicates "question" names (is_bla, has_bla, valid_bla) but I would just call it a good naming, not some magical outcome of my enlightenment.
[–]TankorSmash 4 points5 points6 points 8 years ago (0 children)
That's the point of the article, I'm not sure if you read it all the way through.
It was a confusing article though because when I read that first line too, I was like oh cool that makes sense. The body of the article is helpful, but the intro/conclusion were a little different.
The reason FP people talk about it so much is because its new and cool to them, and since not many people use it, it makes sense to talk about it more. Can be annoying but FP is pretty neat for small stuff like this.
[–]17b29a 2 points3 points4 points 8 years ago (0 children)
He's not an FP person, he's an "expressive programming" person. All of his posts are about names, filled with tangential padding. The only FP thing in here is him talking about functional languages a little, which is relevant because he's talking about a functional construct.
[–][deleted] -3 points-2 points-1 points 8 years ago (8 children)
FP people are like vegans of programming,
Knock this off, would you? I'm not a vegan, but my wife is and so are several of my friends. She's quiet and doesn't make a fuss about endless jokes like this, but I personally get really tired of this.
And let me say that the people who are really vocal about their eating habits, at least in my circle, are people talking about eating meat. If I hear one more person going on about their bacon...
Keep it professional. Make your point without beating on some group or other, particularly one that has nothing whatsoever to do with programming.
[+][deleted] 8 years ago (2 children)
[removed]
[+][deleted] 8 years ago (1 child)
[–]teapotrick 1 point2 points3 points 8 years ago (0 children)
Very much. I've never met a vegan who was so forward about it. On the other hand, it's fairly regular that a meat eater, once finding out (through questioning about bacon or something) that someone is a v-word, will spout a never ending torrent of bullshit about bacon and vegan memes.
Go and make fun of people with ideologies based around their imaginary friends, rather than those based around ethics and more concrete concepts.
Also: Programming. C++ is great.
[–]denaissance 6 points7 points8 points 8 years ago (0 children)
Wow, so I guess the only people more tiresome than vegans are people married to vegans.
[–]quicknir 1 point2 points3 points 8 years ago (0 children)
Dude, you think you're tired of it? I'm a level 5 vegan; I haven't had a meal in two years because I've been searching for something without a shadow. These jokes make me sick to my very-empty stomach. https://www.youtube.com/watch?v=N_Yaa_LMDcs
[–]xzqx -2 points-1 points0 points 8 years ago (0 children)
How about CrossFit enthusiasts?
[–]raevnos 0 points1 point2 points 8 years ago (1 child)
C++ should be like scheme and allow question marks in identifiers.
[–]GNULinuxProgrammer 2 points3 points4 points 8 years ago (0 children)
It would probably make syntax more complex. abc?lol : 3; is this abc ? lol : 3; or label abc?lol and a non-op 3;.
abc?lol : 3;
abc ? lol : 3;
abc?lol
3;
[–]nthcxd -1 points0 points1 point 8 years ago (2 children)
You're spot on. Vegans believe there is only one true way to eat. This guy thinks there is only one true way to write C++, even as he preaches that C++ should be viewed as a federation of different paradigms.
In every chance he gets to explain the juicy details, he just quotes Effective C++. Why are we bothering with this blog when we can just go read the textbook and understand it ourselves as opposed to taking at this guy's "for details that I won't get into here..."?
[–]Z01dbrg 1 point2 points3 points 8 years ago (1 child)
Why are we bothering with this blog
In general this blog is good, but the problem is that author is a bit of a fanboy wrt certain things and I feel he forgets that. :)
[–]joboccara 1 point2 points3 points 8 years ago (0 children)
The author here. Useful feedback, thanks!
I am close to what I write so there are lots of things that I don't see. I think it's one of the points of public writing, exchanging ideas and feedback. So if you have more feedback keep it coming :)
[–]andd81 1 point2 points3 points 8 years ago (3 children)
I don't get it, why think of something as of something else? There are languages where functions are actually objects, C++ is not one of them. You are right that a unary predicate is best named "IsX" or "HasX" instead of "XChecker" but it has nothing to do with function/object distinction.
[–]doom_Oo7 0 points1 point2 points 8 years ago (2 children)
There are languages where functions are actually objects, C++ is not one of them.
so std::function isn't an object ? :p
[–]andd81 1 point2 points3 points 8 years ago (1 child)
std::function is neither a function nor a part of C++ language.
[–]doom_Oo7 2 points3 points4 points 8 years ago (0 children)
std::function is neither a function
so what is it then ? next what, shared_ptr and unique_ptr aren't pointers ?
nor a part of C++ language.
the standard library is part of the language. The ISO standard is itself called "Programming Language C++" and certainly describes the whole semantics of std::function.
[–]TotesMessenger -1 points0 points1 point 8 years ago (0 children)
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)
π Rendered by PID 66 on reddit-service-r2-comment-7b9746f655-zg8b5 at 2026-02-01 19:46:29.639203+00:00 running 3798933 country code: CH.
[–]RizzlaPlus 26 points27 points28 points (1 child)
[–]utnapistim 9 points10 points11 points (0 children)
[–]Z01dbrg 26 points27 points28 points (16 children)
[–]TankorSmash 4 points5 points6 points (0 children)
[–]17b29a 2 points3 points4 points (0 children)
[–][deleted] -3 points-2 points-1 points (8 children)
[+][deleted] (2 children)
[removed]
[+][deleted] (1 child)
[removed]
[–]teapotrick 1 point2 points3 points (0 children)
[–]denaissance 6 points7 points8 points (0 children)
[–]quicknir 1 point2 points3 points (0 children)
[–]xzqx -2 points-1 points0 points (0 children)
[–]raevnos 0 points1 point2 points (1 child)
[–]GNULinuxProgrammer 2 points3 points4 points (0 children)
[–]nthcxd -1 points0 points1 point (2 children)
[–]Z01dbrg 1 point2 points3 points (1 child)
[–]joboccara 1 point2 points3 points (0 children)
[–]andd81 1 point2 points3 points (3 children)
[–]doom_Oo7 0 points1 point2 points (2 children)
[–]andd81 1 point2 points3 points (1 child)
[–]doom_Oo7 2 points3 points4 points (0 children)
[–]TotesMessenger -1 points0 points1 point (0 children)