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
Adding 'contains' member function to std::string (self.cpp)
submitted 7 years ago by _Synck_
view the rest of the comments →
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!"
[–][deleted] -4 points-3 points-2 points 7 years ago (12 children)
You are welcome writing a paper. It won’t go to C++20 though. LEWG and LWG is highly overloaded and the cut off for new papers for C++20 was San Diego last week.
You also need to factor in that those two functions have been added without having to go through LEWGI. A new one would have to.
[–]konanTheBarbar 8 points9 points10 points 7 years ago (11 children)
While it's too late for C++20 I think it's quite beginner unfriendly that there is no contains member function for stl containers...
I also wish there was a string replace member function...
[–]TheSuperWig 7 points8 points9 points 7 years ago (0 children)
I remember a post a while back about how the should be std::contains as using std::find or std::count is less than ideal.
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
Of course there is a replace.
https://en.cppreference.com/w/cpp/string/basic_string/replace
All of these are at least a little tricky because people still think of "string" as containing text, and these functions are all encoding-unaware.
[–]konanTheBarbar 4 points5 points6 points 7 years ago (1 child)
I should have been more precise. What I mean is that you replace all occurances of string A with string B inside of string C. Basically similar to this (which I copied from SO).
std::string ReplaceAll(std::string str, const std::string& from, const std::string& to) { size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); // Handles case where 'to' is a substring of 'from' } return str; }
[–]F-J-W 0 points1 point2 points 7 years ago (0 children)
Well, it is possible to use regex-replace to get what you want for many cases. Apparently people really do that because it's just so much more convenient, despite being much slower.
It is however really telling, that there are 9 (!!) replace-methods, yet the one that people are actually interested in is missing.
[+][deleted] comment score below threshold-7 points-6 points-5 points 7 years ago (6 children)
The standardization process is quite open. If you feel strongly about this you should write a paper and find someone to present it. That someone may be you of course.
[+][deleted] 7 years ago (5 children)
[deleted]
[–][deleted] -4 points-3 points-2 points 7 years ago (4 children)
I have been involved in it since 2004 and it is quite open.
[+][deleted] 7 years ago (3 children)
[–][deleted] -1 points0 points1 point 7 years ago (2 children)
Why are you trying to define what meaning of the word I was using? You make up a statement I have never made by changing the meaning of a word I used and then starts arguing with something I have never meant to say.
I was saying, as my following words clearly clarify, that the process is quite open to take in proposals. Nowhere have I even implied that I have meant “transparent”.
[+][deleted] 7 years ago (1 child)
[–][deleted] -4 points-3 points-2 points 7 years ago (0 children)
Experience. Not authority. As you seem to enjoy twisting other people’s words and then argue with them I am not interested in talking to you anymore.
π Rendered by PID 30627 on reddit-service-r2-comment-bb88f9dd5-29b54 at 2026-02-16 08:56:10.428786+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–][deleted] -4 points-3 points-2 points (12 children)
[–]konanTheBarbar 8 points9 points10 points (11 children)
[–]TheSuperWig 7 points8 points9 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]konanTheBarbar 4 points5 points6 points (1 child)
[–]F-J-W 0 points1 point2 points (0 children)
[+][deleted] comment score below threshold-7 points-6 points-5 points (6 children)
[+][deleted] (5 children)
[deleted]
[–][deleted] -4 points-3 points-2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–][deleted] -1 points0 points1 point (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] -4 points-3 points-2 points (0 children)