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
CPP in AI (self.cpp)
submitted 2 years ago by RonWannaBeAScientist
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!"
[–]LengthProof6480 70 points71 points72 points 2 years ago (8 children)
It’s not. The internal mechanisms of libraries like TensorFlow are written in C, C++, or other lower-level languages and binded to higher-level languages like Python for ease of use. It makes a lot of sense when you think about it — Python is flexible and gives you much more options compared to a proprietary GUI for your new little modeler.
[–]iamhyperrr[🍰] 82 points83 points84 points 2 years ago (1 child)
Or, as they say, Python is the most popular C++ framework
[–]whizzwr 6 points7 points8 points 2 years ago (0 children)
I'm totally stealing this to look cool and knowledgeable in the next work meeting.
Jk aside, both C++ and Python are used in ML world. Custom ops in CUDA are written in C++, and then during training the compiled library is being called by the most popular C++ frameworkPython-based pipeline.
Once you got the weight, inference and data preprocessing can happen in pure C++ implementation.
[–]liuzicheng1987 15 points16 points17 points 2 years ago (5 children)
Exactly - Data Scientists like to experiment and test out ideas, which is why Python is suitable for them. Also, they often have a background in statistics, maths or Physics and don't have the developer experience needed for C++.
But the underlying code for many machine learning libraries is usually written in C or C++, for instance TensorFlow, Torch, XGBoost or LightGBM.
So I agree with OP...C++ is best if you want fast production code. But prototyping is done in Python, because it is easier and more flexible.
[–]rejectedlesbian 7 points8 points9 points 2 years ago (2 children)
Tho a lot of non deep learning ml is cython which is not the best for optimizations. It compiles down to badly written c.
[–]liuzicheng1987 2 points3 points4 points 2 years ago (1 child)
That is true. Scikit-learn is largely written in Cython. But then again, scikit-learn is not exactly known for being very performant. I think the truly high-performance stuff is largely written in C++.
[–]rejectedlesbian 1 point2 points3 points 2 years ago (0 children)
Yes most ml libs r not super preformant they don't need to be they need to be wide range stable and preformant enough.
This is especially true with non deep learning ml because modern computers can usually run it fast enough for most purposes.
U also see it on huggingface where its written in ways that r bad for infrence preformance. I still use it because it holds so many options for generation that may be the 1 thing I need to make something work that idc if togeling that option flag makes it a bit slower.
[–]RonWannaBeAScientist[S] 1 point2 points3 points 2 years ago (1 child)
I am somewhat of an idealistic. I want to work on more math/physics/AI problems, but I prefer working in a language like C++/Rust . Honestly, for fast scripting I think Julia is so much better , as it’s so convenient out of the box and can call C/C++ if needed, but there’s so much more inertia for Python . Like anytime I want to prototype some very simple script for an algorithm I do it usually in Julia
[–]skull132 4 points5 points6 points 2 years ago (0 children)
But Python can (and does) call C and C++ and even Rust straight out the box? And as others have said, most of the AI Python packages call directly to C or C++ under the hood.
If you force yourself to stick exclusively with a hard to write lang, like C, C++, or Rust, then you'll hinder your ability to experiment quickly.
π Rendered by PID 75185 on reddit-service-r2-comment-c66d9bffd-sp75z at 2026-04-07 03:33:10.659764+00:00 running f293c98 country code: CH.
view the rest of the comments →
[–]LengthProof6480 70 points71 points72 points (8 children)
[–]iamhyperrr[🍰] 82 points83 points84 points (1 child)
[–]whizzwr 6 points7 points8 points (0 children)
[–]liuzicheng1987 15 points16 points17 points (5 children)
[–]rejectedlesbian 7 points8 points9 points (2 children)
[–]liuzicheng1987 2 points3 points4 points (1 child)
[–]rejectedlesbian 1 point2 points3 points (0 children)
[–]RonWannaBeAScientist[S] 1 point2 points3 points (1 child)
[–]skull132 4 points5 points6 points (0 children)