1
5
wxWidgets 3.2.5 Released (www.wxwidgets.org)
submitted 3 hours ago by lysdexic to c/cpp
2
4
submitted 3 days ago by lysdexic to c/cpp
3
1
submitted 1 day ago by lysdexic to c/cpp
4
5
submitted 1 week ago by cmeerw to c/cpp
5
7
submitted 1 week ago by lysdexic to c/cpp
6
16
submitted 1 week ago by lysdexic to c/cpp
7
13
GCC 14.1 Released (gcc.gnu.org)
submitted 1 week ago by cmeerw to c/cpp
8
14
submitted 2 weeks ago by lysdexic to c/cpp
9
13
submitted 3 weeks ago by lysdexic to c/cpp
10
15
submitted 3 weeks ago by lysdexic to c/cpp
11
14
submitted 3 weeks ago by lysdexic to c/cpp
12
18
submitted 3 weeks ago by [email protected] to c/cpp

In c++17, std::any was added to t he standard library. Boost had their own version of "any" for quite some time before that.

I've been trying to think of a case where std::any is the best solution, and I honestly can't think of one. std::any can hold a variable of any type at runtime, which seems incredibly useful until you consider that at some point, you will need to actually use the data in std::any. This is accomplished by calling std::any_cast with a template argument that corresponds to the correct type held in the std::any object.

That means that although std::any can hold a type of any object, the list of valid objects must be known at the point that the variable is any_cast out of the std::any object. While the list of types that can be assigned to the object is unlimited, the list of types that can be extracted from the object is still finite.

That being said, why not just use a std::variant that can hold all the possible types that could be any_cast out of the object? Set a type alias for the std::variant, and there is no more boilerplate code than you would have otherwise. As an added benefit, you ensure type safety.

13
5
submitted 1 month ago by lysdexic to c/cpp
14
28
submitted 1 month ago by lysdexic to c/cpp
15
7
submitted 1 month ago by lysdexic to c/cpp
16
23
submitted 1 month ago by SuperFola to c/cpp
17
6
submitted 1 month ago by lysdexic to c/cpp
18
8
submitted 1 month ago by cmeerw to c/cpp

Please take 10 minutes or so to participate! A summary of the results, including aggregated highlights of common answers in the write-in responses, will be posted publicly here on isocpp.org and shared with the C++ standardization committee participants to help inform C++ evolution.

The survey closes in one week.

19
15
submitted 1 month ago by lysdexic to c/cpp
20
31
submitted 1 month ago by [email protected] to c/cpp
21
29
submitted 1 month ago by [email protected] to c/cpp

I've been trying to learn a system language because it would enable me to access a whole new world of possibility for games, tools, and potential projects. My main problem when learning the language are:

  • can I write modern C++ code using the newer standards and still compile with libraries from older standards?
  • how do I even organize a C++ project? Look at the linked project, the CMakeList.txt is so hard to understand, the syntax looks so hard to write.
  • how do I install dependencies? You're going to laugh at me, but I always used languages with package managers and I looked again at the linked project, and they write a whole CMakeList.txt to import ImGui (GUI library I wanna try) but if you compare the structure of the files, it's different from the ones on the repository of ImGui.

As you see there are a lot of problems and it pains me to not be able to solve them because Rust is so unfun to use and work with! Do you think I should try C++, carry one with it?

Thanks, hector.

22
12
submitted 1 month ago by lysdexic to c/cpp
23
4
submitted 1 month ago by lysdexic to c/cpp
24
11
submitted 1 month ago by lysdexic to c/cpp
25
7
submitted 1 month ago by lysdexic to c/cpp
view more: next ›

C++

1584 readers
5 users here now

The center for all discussion and news regarding C++.

Rules

founded 11 months ago
MODERATORS