Anonymous
Using typedefs in C++17 is kinda lame
Pavel
Using typedefs in C++17 is kinda lame
Yes I was talking about type aliases, just didn't know how to properly name them
Anonymous
But tbh I don't get what you need
Pavel
C++11 type aliases can be templated
That's not what I meant about template specifications. I meant having the ability to have different template specifications for different types of aliases. E.g. if I have an alias like that using PathStr = std::string; I want to be able to have different implementations for them in cases like that ConstructEditor<std::string>(); ConstructEditor<PathStr>(); And that this will not compile: std::string a = "test"; PathStr b = "/test"; if (a == b) { ... } as well as this std::string a = "test"; PathStr b = a; or this PathStr a = "/test"; std::string b = a; but this would compile std::string a = "test"; PathStr b = static_cast<PathStr>(a);
Pavel
Please Do not derive from standard containers They must have been marked as final
I'm not going to use polymorphic calls on them, other than that it should be fine.
Pavel
Well, even that would be fine, as long as I don't delete my classes using a pointer to std::string. But I guess even that would be fine because I don't provide any new members.
Anonymous
Ok
2foryou
I am using unordered map and I have string keys for example "saldhkagdka" later on I check if (!un_map["simple_example"]){ // do stuff } i get segmentation fault can you tell me how can I forbid accessing If out of range but know when a vallue of a key exist?
Anonymous
If a key is not in a map, it inserts key and a value for that is default initilized
2foryou
ok so I have to find why thanks
2foryou
so in this example you are sayng that "simple_example" is added to the map whith empty vllue?
Javi
If you are using the value of the map inside the if, that's why. As @Danya said, when the key doesn't exist, it inserts a value, what would give you undefined behaviour depending on what's inside the if
Anonymous
so in this example you are sayng that "simple_example" is added to the map whith empty vllue?
https://en.cppreference.com/w/cpp/container/unordered_map/operator_at
Anonymous
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.
Anonymous
so, basically yes
2foryou
inside the If I do some calculation with the vallue that I have in the if condition what If I want to access that vallue only if it exist and not Insert it if it does not just skip the if?
Ludovic 'Archivist'
inside the If I do some calculation with the vallue that I have in the if condition what If I want to access that vallue only if it exist and not Insert it if it does not just skip the if?
Use my_map.count(my_key) to see if there is any value with that key, or use my_map.find(my_key) which will return a past the end iterator if the key is not found and an iterator to the value if it is found
Anonymous
yes, use find/count
Anonymous
anyway, look at here for more information: https://en.cppreference.com/w/cpp/container/unordered_map
Anonymous
i installed gcc but for some reason its not in the right path
Anonymous
when i to gcc -v it shows the old gcc version
Anonymous
but when i try go bew install it says i have the the new version already
Anonymous
how do i install gcc in the proper path
Anonymous
Look for update-alternatives
i trying to install the latest version of gcc, i have it install but its not in the right path
Anonymous
helo
Anonymous
anyone there
01000001011011010100000101101110
Can you purge the old version?
Anonymous
i am using hombrew on a mac
Anonymous
been trying to get help with this for two days now
01000001011011010100000101101110
01000001011011010100000101101110
Can you purge the old version?
Purge is like "removing"
01000001011011010100000101101110
So can you remove/delete the older version?
01000001011011010100000101101110
i am using hombrew on a mac
I've never worked on it..you need to find this out
Nameful
How would I tell CMake to compile a specific file and use it as a library for my project?
Nameful
I have ./include/glad/glad.h, which I have managed to get set up, and then glad.c which I haven't figured out how to set up
Nameful
Currently it complains about undefined references
Nameful
If I add glad.c to my add_executable() it gives me this
Nameful
Not entirely sure what that's about
Artöm
how do i install gcc in the proper path
Homebrew uses different paths. You need to make it first in paths list
Anonymous
Hey, whats the "correct" way to pass a static multi dimenstional array by reference to a function? (In ansi c). My soluution was to pass the dimenstions+size and a char pointer to the beginning and cast it back in the function to work on it. But i think this ist very elegant or the way one is supposed to do that.
@t
Such is a very good heart
Anonymous
klimi
I have ./include/glad/glad.h, which I have managed to get set up, and then glad.c which I haven't figured out how to set up
Oh you're starting with opengl? UwU... I was having same error but I found out how to fix it. I dont remember it tho... But it should be on my git
mushaffiq
Can any one send me sll in c video
mushaffiq
Any nice youtube
Talula
Any nice youtube
yes... www.youtube.com
mushaffiq
Are mere bhai koi acha youtber bol mujhe smajahe
Talula
Are mere bhai koi acha youtber bol mujhe smajahe
Anyone who is not India is normally good.
mushaffiq
😅
Anonymous
Are mere bhai koi acha youtber bol mujhe smajahe
Don't speak any other language pls read the rules
klimi
This is a joke right? @roxifas
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
/warn offtopic
Roxifλsz 🇱🇹
Oh well
Roxifλsz 🇱🇹
That solves that
Anonymous
Any CMAKE/VCPKG users?, Mine is always thorwing this Could not find a configuration file for package "spdlog" that is compatible with requested version "". The following configuration files were considered but not accepted: D:/Data/vcpkg/installed/x64-windows/share/spdlog/spdlogConfig.cmake, version: 1.3.1 (64bit)
Anonymous
https://hasteb.in/donawila.m
Anonymous
I think the architecture aint set or so
many
I've been implementing snake game in terminal. Whenever the snake moves, the screen refreshes. However the screen flashes when the snake moves faster. How to reduce/avoid the flashes (like "less" command)?
many
It flashes more often when the snake is moving faster, or does the screen suddenly start flashing? Also, how are you refreshing the screen?
Print another big block of spaces and move the snake by the width of a character. It's like redrawing the entire canvas
many
What's the magic behind the "less" command? Seems that it doesn't need redrawing. It simply create a new environment and users can navigate up and down
Foxner
Print another big block of spaces and move the snake by the width of a character. It's like redrawing the entire canvas
That's one way to do it. From my experience this way produces less flashing than clearing the console and redrawing the scene.
many
Use ncurses
Exactly. Thank you😊