-
Stay up-to-date with everything C++! Content directly fetched from the subreddit just for you. Join our group for discussions : @programminginc Powered by : @r_channels
C++20 feature testing
What does c++20 feature testing do? How is it beneficial?
https://redd.it/17esrnu
@r_cpp
Friend: What is C++ idiom Hidden Friend? - Peter Bindels - [https://youtu.be/H5TEUiEplY0](https://youtu.be/H5TEUiEplY0)
* Lightning Talk: Port Exhaustion in .NET Framework - Wiktor Klonowski - [https://youtu.be/0WmriNuQu60](https://youtu.be/0WmriNuQu60)
A new post will be made each week as more videos are released.
https://redd.it/17eo49y
@r_cpp
C++ Videos Released This Month - October 2023 (Updated To Include Videos Released 10/16/23 - 10/22/23)
This month the following C++ videos have been published to YouTube
**CppCon**
The following videos have been pre-released
* Plenary: Coping With Other People's Code - Laura Savino - [https://youtu.be/qyz6sOVON68](https://youtu.be/qyz6sOVON68)
* Plenary: Cooperative C++ Evolution – Toward a Typescript for C++ - Herb Sutter - [https://youtu.be/8U3hl8XMm8c](https://youtu.be/8U3hl8XMm8c)
* Robots Are after Your Job: Exploring Generative AI for C++ - Andrei Alexandrescu - [https://youtu.be/J48YTbdJNNc](https://youtu.be/J48YTbdJNNc)
* Delivering Safe C++ - Bjarne Stroustrup - [https://youtu.be/I8UvQKvOSSw](https://youtu.be/I8UvQKvOSSw)
* Libraries: A First Step Toward Standard C++ Dependency Management - Bret Brown & Bill Hoffman - [https://youtu.be/IwuBZpLUq8Q](https://youtu.be/IwuBZpLUq8Q)
**CppNorth**
10/09/23 - 10/15/23
* Lightning Talk: Type-safe Dictionaries in Cpp - Vincent Tourangeau - [https://youtu.be/i9p\_qFW6hJ4](https://youtu.be/i9p_qFW6hJ4)
* Lightning Talk: The Quest for Shorter Functions in C++ - Diana Ojeda Aristizabal - [https://youtu.be/ngE3OimVY-Q](https://youtu.be/ngE3OimVY-Q)
* Lightning Talk: FM Demodulation with RTL-SDR - Doug Hoyte - [https://youtu.be/kKz5p8fNiYI](https://youtu.be/kKz5p8fNiYI)
* Lightning Talk: Learning Curves - Miro Knejp - [https://youtu.be/aw7Eb7Jn6LM](https://youtu.be/aw7Eb7Jn6LM)
* Lightning Talk: Your Hands Are Very Important - Jeremy Mark Tubongbanua - [https://youtu.be/ggMQrrpZSVM](https://youtu.be/ggMQrrpZSVM)
* Lightning Talk: sizeof((std::variant( double, char\[10\])) - Olivia Wasalski - [https://youtu.be/f2Fs\_UFMB10](https://youtu.be/f2Fs_UFMB10)
* Lightning Talk: Decoupling Test & Simulation Code from Production Code - Rafael Ottmann - [https://youtu.be/4lz0lh6C0v4](https://youtu.be/4lz0lh6C0v4)
* Lightning Talk: Keys to Conscious Creation - Intersection of Piano Artistry & Ethical AI - [https://youtu.be/FkA\_HrcsiQk](https://youtu.be/FkA_HrcsiQk)
* Lightning Talk: Virtual Functions in C++ Are Not Slow - Rud Merriam - [https://youtu.be/Dpk0z4iUFcM](https://youtu.be/Dpk0z4iUFcM)
* Lightning Talk: DYLPSAC++MT!! The making of! - Pier-Antoine Giguère - [https://youtu.be/0NO0qc0-9u4](https://youtu.be/0NO0qc0-9u4)
* Lightning Talk: Amortized O(1) Complexity - Andreas Weis - [https://youtu.be/F4UUu2c3rWY](https://youtu.be/F4UUu2c3rWY)
* Lightning Talk: Faster Filtering with Flux in C++ - Tristan Brindle - [https://youtu.be/wAOgEWzi4bk](https://youtu.be/wAOgEWzi4bk)
* Lightning Talk: Intelligence Will Kill Us All - Jessica Kerr - [https://youtu.be/68AswgNxwwY](https://youtu.be/68AswgNxwwY)
* New Algorithms in C++23 - Conor Hoekstra - [https://youtu.be/VZPKHqeUQqQ](https://youtu.be/VZPKHqeUQqQ)
* C++ Feature Coroutines, Beginner Friendly - Andreas Fertig - [https://youtu.be/9kRbEkcx-hw](https://youtu.be/9kRbEkcx-hw)
10/01/23 - 10/08/23
* Writing C++ to Be Read - Vincent Zalzal - [https://youtu.be/ABnf8NV6yEo](https://youtu.be/ABnf8NV6yEo)
* Compiler Explorer 2023: What’s New? - Matt Godbolt - [https://youtu.be/Ey0H79z\_pco](https://youtu.be/Ey0H79z_pco)
* Keynote: C++ Contracts, Testing & the Pursuit of Well Defined Behaviour - Timur Doumler - [https://youtu.be/jTuIzSUxYDc](https://youtu.be/jTuIzSUxYDc)
* Vulnerable C++ - Peter Sommerlad - [https://youtu.be/A6\_EJ80SAmA](https://youtu.be/A6_EJ80SAmA)
* Value Oriented Programming Part V: Return of the Values - Tony Van Eerd - [https://youtu.be/gqopX4VInQw](https://youtu.be/gqopX4VInQw)
* Iteration Revisited: A Safer Iteration Model for C++ - Tristan Brindle - [https://youtu.be/l3AxYei17ls](https://youtu.be/l3AxYei17ls)
* C++ as an Optimizing Assembler - a Performance Talk - Levo DeLellis - [https://youtu.be/kgUXfDpAmGQ](https://youtu.be/kgUXfDpAmGQ)
* Object Lifetime in C++: From Start to Finish - Thamara Andrade - [https://youtu.be/CqyqJbrVrrk](https://youtu.be/CqyqJbrVrrk)
**C++ on Sea**
10/16/23 - 10/22/23
* Most Malleable Memory Management Method in C++ - Björn Fahller -
Is C++ a top option for building software that may not be changed over the years?
Hello,
I was wondering if software created in C++ is easy to maintain, I know this is a very generic question so I'll ask with an example, imaging if I create a small HTTP API that returns the sum of two numbers I pass. Would that require changes when new operative systems or versions of the compiler are released?
To provide some context, the main reason I'm asking is because I have been written PHP for some years and while it doesn't change much, things created in old versions of PHP usually require changes to run in new versions of PHP and the old versions are insecure and not maintained. My experience with maintaining python is also bad, especially when some operative system where ship with python 3 while other continue to use python 2. My experience gets worst with Node.js, my actual main language at work, lots of effort to maintain existing software.
https://redd.it/17ejub3
@r_cpp
No matching constructor for initialization of 'Eigen::Matrix3f'
I am trying C++ Eigen library inside jupyter notebook with xeus-cling. I am able to run basic example. However, when I try to declare a variable of type Eigen::Matrix3f, it gives error:
no matching constructor for initialization of 'Eigen::Matrix3f'
as can be seen in the screen shot below: screenshot
What I am missing here?
PS: I followed steps specified here to setup xeus-cling.
https://redd.it/17eirae
@r_cpp
Generating Data In Large Sets
Hello I have this active problem/question:
https://stackoverflow.com/questions/77342100/generating-data-for-opengl-2d-rendering-perfomance-is-slow-but-monogame-gls-dat
(I'm wondering how the Monogame codebase allows me to generate a 1000x1000 tile map in like 2 seconds but my custom generation shown in the post and game engines such as Unity and Godot take likes 8 minutes for a 400x400 tile map)
Where I am trying to generate a lot of data (like around 500k\~1M items) to use in graphics rendering and I am wondering what are some good techniques in handling this situation with things like function calls in for loops. I've been eyeing the Monogame.GL data generation/draw call definition lines but have not seen anything too out of the ordinary compared to my code.
I'm using OpenGL as well.
Please if you have any information, suggestions, or questions let me know me and thank you!.
https://redd.it/17e7v27
@r_cpp
What's the recommended way to store type-erased copyable values?
The way std::function can hide the type of the underlying function is very useful, and I'd like to use this pattern in my code too. I want a single abstract type to represent many concrete types. How does everyone else do this? Things I've tried:
`std::unique_ptr<MyBaseClass>`: Not copyable. Maybe I can expose a `clone()` method, but it imposes clunky requirements on every class in the hierarchy hierarchy.
std::any. By design, it hides everything about the underlying type. I'd like to keep some common functionality exposed (e.g the way std::function objects can be called without knowing the runtime type of the underlying object).
I eventually wrote a super-simple wrapper called any_of<MyBaseClass>, which mostly works (github). But it feels like the kind of thing that must have already been done a thousand times. How does everyone else do this? I would rather not keep a custom thing if there is a more widely known way of doing this same thing.
https://redd.it/17e0oxx
@r_cpp
Zstring library
Is there a library that offers a class that views a null terminating string? I need it to interface with C APIs.
The constructor should accept char[\], char*, const char* const char[\], std::string, std::string_view.
It seems that GLS does not offer an implementation of "zstring". I've found this but it seems overkill
https://redd.it/17dy0ld
@r_cpp
This will save the future of C++
https://www.geeksforgeeks.org/cpp-20-std-format/
Very, VERY long waited feature which I believe will save the whole language :)
https://redd.it/17dopkw
@r_cpp
std::to_string(char) does not exist.
std::stringstream ss;
ss << 'X';
return ss.str();
This returns `"X"`
return boost::lexical_cast<std::string>('X');
This returns `"X"`
return std::to_string('X');
This returns `"88"`
Is it a conscious decision that `std::to_string(char)` relies on the `char` being promoted to an `int`?
Also, is it intended that the various `std::to_string()` overloads will eventually use `std::to_chars` underneath to do the conversion?
https://redd.it/kxyqp5
@r_cpp
mold: A Modern Linker
https://github.com/rui314/mold
https://redd.it/kxvw5c
@r_cpp
Learning
Guys i am new to c++ language and i find it really difficult any advice to become a pro c++ programmer please help
https://redd.it/kxrjyg
@r_cpp
CppCast: Priorities for C++23
https://cppcast.com/priorities-for-23-corentin-jabot/
https://redd.it/kxmtme
@r_cpp
What jobs should I be looking for when stepping into the field?
I am a student and almost completed my associates degree. I am looking for work since the campus is shut down right now. I have no paid history as a programmer, except for an offer from a friend to help with his video game mod. I've been told by my friends and colleagues (also programmers) that I have the skills and aptitude to be an employable programmer, so I even have some reliable references. I am not sure what I would be looking for in an employer within this field or what title I would be qualified for.
I have experience coding in Python for 1.5 years and experience in C/C++ for about 1 year. I generally pick things up very quickly. I understand Data Structures, sorting algorithms, worked with SQLite3 (in an ORM fashion), and I handle micro-controllers and electronics often. I have projects that are still works-in-progress but unfortunately nothing that is fully completed or polished yet.
What jobs should I be applying for with my level of experience? (i.e job titles that I can search for on job boards).
https://redd.it/kxlkzr
@r_cpp
Finding Bugs in C and C++ Compilers using YARPGen
https://blog.sigplan.org/2021/01/14/finding-bugs-in-c-and-c-compilers-using-yarpgen/
https://redd.it/kxgze4
@r_cpp
Don’t use the [[likely]] or [[unlikely]] attributes
https://blog.aaronballman.com/2020/08/dont-use-the-likely-or-unlikely-attributes/
https://redd.it/17el4vp
@r_cpp
[https://youtu.be/ptMFLSAkRj0](https://youtu.be/ptMFLSAkRj0)
* Automatic Caching for C++ Builds: Merging Git and the Compiler - Damien Buhl - [https://youtu.be/2u-VuOBOCTI](https://youtu.be/2u-VuOBOCTI)
* Hidden Hazards: Unique Burnout Risks in Tech - Dr. Allessandria Polizzi - [https://youtu.be/iCEIwkpYZeM](https://youtu.be/iCEIwkpYZeM)
* Lightning Talk: How to Utilize Parallelism in Your Home Office - Tina Ulbrich - [https://youtu.be/2wiO1scoVf4](https://youtu.be/2wiO1scoVf4)
* Lightning Talk: Does AVX512 Reduce Power Consumption? - Andrew Drakeford - [https://youtu.be/4hBzQm\_6700](https://youtu.be/4hBzQm_6700)
* Lightning Talk: When C++ Singletons Fail... Richard Shepherd - [https://youtu.be/2T5dIwAXCqc](https://youtu.be/2T5dIwAXCqc)
10/09/23 - 10/15/23
* Endnote: AI-Assisted Software Engineering - Bryce Adelstein Lelbach - [https://youtu.be/19Sr8XhN0BM](https://youtu.be/19Sr8XhN0BM)
* The Power of C++ Templates With mp-units: Lessons Learned & a New Library Design - Mateusz Pusz - [https://youtu.be/eUdz0WvOMm0](https://youtu.be/eUdz0WvOMm0)
* Building RESTful Interfaces in C++ With nlohmann and cpp-httplib - Kevin Carpenter - [https://youtu.be/uqPTzUdNLZk](https://youtu.be/uqPTzUdNLZk)
* An Engineering Approach to Optimising C++ - Dave Rowland - [https://youtu.be/TEeBcjKZhfg](https://youtu.be/TEeBcjKZhfg)
* Implementing Fast Calendar Algorithms: Speeding Date - Cassio Neri - [https://youtu.be/J9KijLyP-yg](https://youtu.be/J9KijLyP-yg)
10/01/23 - 10/08/23
* The Small Pearls of C++20 - Rainer Grimm - [https://youtu.be/BhMUdb5fRcE](https://youtu.be/BhMUdb5fRcE)
* How to Simulate a Low Latency Exchange in C++ - Benjamin Catterall - [https://youtu.be/QQrTE4YLkSE](https://youtu.be/QQrTE4YLkSE)
* \*(char\*)0 = 0; - What Does the C++ Programmer Intend With This Code? - JF Bastien - [https://youtu.be/dFIqNZ8VbRY](https://youtu.be/dFIqNZ8VbRY)
* Employing Modern C++ for High Performance Delta-Coding Compression - Eduardo Madrid - [https://youtu.be/CZMuMINaS5Q](https://youtu.be/CZMuMINaS5Q)
* Polymorphism, Cohesion, and Coupling in C++ - Jody Hagins - [https://youtu.be/sxKetQVPivI](https://youtu.be/sxKetQVPivI)
* C++ MythBusters Strike 2 - Victor Ciura - [https://youtu.be/8FlP0FiARAI](https://youtu.be/8FlP0FiARAI)
* Midnote: Why Cpp Loops End - Lisa Lippincott - [https://youtu.be/DaCb8iB0a5I](https://youtu.be/DaCb8iB0a5I)
**C++Now**
10/16/23 - 10/22/23
Lightning Talk: Finding My First Compiler Bug - Braden Ganetsky - [https://youtu.be/qnWYUsXvbVg](https://youtu.be/qnWYUsXvbVg)
10/09/23 - 10/15/23
* Lightning Talk: Christie Mystique - Tony Van Eerd - [https://youtu.be/TJ093cmVk2E](https://youtu.be/TJ093cmVk2E)
* Lightning Talk: How to Leverage SIMD Intrinsics for Massive Slowdowns - Matthew Kolbe - [https://youtu.be/GleC3SZ8gjU](https://youtu.be/GleC3SZ8gjU)
10/01/23 - 10/08/23
* Lightning Talk: Into the Lambdaverse — The Beginning - Timur Doumler and Fedor Pikus - [https://youtu.be/j3x1sr\_bzuQ](https://youtu.be/j3x1sr_bzuQ)
* Lightning Talk: Source/Sink vs. Ranges in C++ - What's the Difference? - Tony Van Eerd - [https://youtu.be/BChyPWorFvg](https://youtu.be/BChyPWorFvg)
* Lightning Talk: Hilbert’s Hotel - the Untold Bits - Tobias Loew - [https://youtu.be/grje4g2d1JE](https://youtu.be/grje4g2d1JE)
* Lightning Talk: operator for - C++ Generator Ranges Without Coroutine Overhead - [https://youtu.be/l7ntC-Y1syY](https://youtu.be/l7ntC-Y1syY)
* Lightning Talk: Into the Lambdaverse - Weird C++ Lambda Shenanigans - Timur Doumler - [https://youtu.be/DKqIIn5iglc](https://youtu.be/DKqIIn5iglc)
**ACCU Conference**
* ACCU Lightning Talks: Omnibus Session 3 - ACCU 2023 - [https://youtu.be/4rYwywQ3Pa4](https://youtu.be/4rYwywQ3Pa4)
* ACCU Lightning Talks: Omnibus Session 2 - ACCU 2023 - [https://youtu.be/gQT7xa2gE1Q](https://youtu.be/gQT7xa2gE1Q)
* ACCU Lightning Talks: Omnibus Session 1 - ACCU 2023 - [https://youtu.be/elEEQ4B-at0](https://youtu.be/elEEQ4B-at0)
* Lightning Talk: Really Long Division - David Watson - [https://youtu.be/CFJ3xwMuiD0](https://youtu.be/CFJ3xwMuiD0)
* Lightning Talk: Crouching Dragon, Hidden
I need a way to create a program to add/update/delete from a CSV file inplace
No data structures allowed
only fstream, sstream and string libraries
I only managed to get add operation working
update works iff the update is the same length as the original
I cant move the rows backwards when deleting one
I've worked on this for hours but I cant it doesnt work
I searched a lot but the consensus seems to be dont do that use arrays | create a new file and shit. Like I want to do this for the joy pls help
https://redd.it/17el61r
@r_cpp
How to use std::span from C++20
https://www.cppstories.com/2023/span-cpp20/
https://redd.it/17ejw59
@r_cpp
Include error detected
Hello everyone, i just started with cpp and while trying to write a code on vs code i get these two errors! i tried searching and nothing worked! can someone explain how to solve it in simple terms.
It’s a mac btw.
1- #include error’s detected Please update your includePath
2-cannot open source file “iostream”.Please run the “select IntelliSence config”
https://redd.it/17egvqz
@r_cpp
Simplify C/C++ Project Building with PyMakeCli – A YAML-based Automation Tool
Hey Reddit community, I want to introduce you to a handy tool I've been working on, called PyMakeCli.
PyMakeCli is designed to streamline the process of building C/C++ projects using YAML. It's important to note that PyMakeCli is not intended to replace CMake; rather, it serves as an automation tool to complement CMake. If you're familiar with CMake, you can use PyMakeCli in conjunction with it.
​
In Development: I'm actively working on improving the "Update" command to make the new config file more organized. Your feedback and contributions are welcome.Feel free to check out the repository on GitHub and give it a try. If you have any questions or suggestions, please let me know!
Happy coding! 😊
https://redd.it/17e3a7g
@r_cpp
Order of executing function calls by compiler
\#cpp \#compilers \#code\_execution Interesting case in testing quiz: Any ideas which method from foo1 and foo2 will be executed first?
int foo1() {}
int foo2() {}
void bar(int a, int b) {}
int main() {
bar(foo1(), foo2());
}
​
​
https://redd.it/17dzglp
@r_cpp
C++ and Wireshark
Can anyone to write a C++ program that reads packets from a Wireshark saved file, extracts source and destination IP addresses from the packet headers, and then writes them to a new .csv file.
https://redd.it/17dvvyy
@r_cpp
Which GUI library do you use?
View Poll
https://redd.it/17d9k7a
@r_cpp
GDBFrontend v0.5.0-beta released!
https://github.com/rohanrhu/gdb-frontend/releases/tag/v0.5.0-beta
https://redd.it/kxyceg
@r_cpp
How to get absolute file path for every file?
If anyone could help me that be great thanks!
https://redd.it/kxtfyy
@r_cpp
Passing a 2D matrix to a function with changing the matrix elements?
Hi all,
I want to pass a 2D matrix to a function. The function is going to modify the elements. But I don't want my original matrix to be altered. Do you have any idea?
I want something like IN, OUT, INOUT from FORTRAN.
An example code to illustrate what is happening is included below#include <iostream>using namespace std;void myFunc(int N, int **A){for (int i=0; i<N; i++){for (int j=0; j<N; j++){A[i][j] = i+j;}}}int main(){int N=3;// Declare a 2D matrixint **A=new int*[N];for (int i=0; i<N; i++){A[i] = new int[N];}// Initialize the 2D matrixfor (int i=0; i<N; i++){for (int j=0; j<N; j++){A[i][j] = 0.0;}}// Call myFuncmyFunc(N, A);// Print the matrixfor (int i=0; i<N; i++){for (int j=0; j<N; j++){printf("%d ", A[i][j]);/* The values of A have changed,I don't want them to change inside main.*/}printf("\n");}return 0;}
https://redd.it/kxp7eu
@r_cpp
Why CMake installs the Build of a Project
Some noob on CMake here.
I understand building with GCC(g++), and MSVC compiler in Windows, and other C++ concepts like linking, classes, OOP, Dynamic library and static libraries.
But I do not understand CMAKE, upon generating the project files, it instructs Visual Studio to install the headers and other files in C:\Program Files. directory
But I do not get the point in installing to the C drive. Because of my different background, I am lately starting with CMake.
I was searching this in internet, but Google could not show any meaningful result or detailed description.
My Question is: If I write 1000 test C++ Programs, would CMake install all of them in Program files. What's the point in installing those?
https://redd.it/kxmkd3
@r_cpp
Speech Synthasizer??
I am new to c++ and have created a terminal based virtual assistant. A really bad Alexa of sorts. just worse. I would like to add a voice command ability and speech. So I speak to it and it speaks back. I've had trouble finding a way to do it since there isnt as much documentation or support as there is for other languages. That's what vie found anyway. Does anyone know of a way to do it
https://redd.it/kxbi91
@r_cpp
Possibility of adding operators to handle nullptr easier ("??", "?->")
Many of you may know that different languages have syntactic sugar to work faster with different things.
For example, C# has the amazing "??" and "?." operators, which could also be very useful in C++ ("?." becoming "?->"). A similar operator was recently added in PHP too (I know, ugh, PHP, but this one operator would be amazing for us too). These two operators, especially the "nullsafe operator" ("?->") could change our lives in C++, in my opinion.
I am pretty frustrated when I have to work with chains of pointers and I have to check a lot for nullptr to avoid crashes. So, instead of having only one line by using multiple nullsafe operators and storing the resulting pointer in a single pointer variable that I will only care about, I actually have to write multiple lines with plenty of nullptr checking, depending on the use case. When switching from C# to C++ this is the thing that frustrates me the most. Accessing pointers that could easily be null in C++ is pretty much a pain.
I don't know if you discussed about these things already in /r/cpp, because I couldn't find anything when searching, so I'm sorry if I'm repeating the question: Was there ever any proposal for a C++ standard to include operators to work easier with null pointers? Was there any progress made in this discussion, such as a denial or a "may do" for the future? Small things, such as these operators and C++20's containers method contains make C++ more pleasant and may attract new developers because it makes the code faster to work with.
https://redd.it/kxflj9
@r_cpp