Anonymous
数学の恋人
You think that's funny?
Anonymous
No
数学の恋人
then stop doing that
Anonymous
Okay sorry. I thought u are chinese. Again sorry.
数学の恋人
Pavel
What is a good way to remove elements from a vector in positions given in another vector (std::vector<size_t> indexesToRemove)?
数学の恋人
Pavel
Maybe iterating in reverse and erase should be better 🤔
数学の恋人
what about iterating over the original vector and use std::find to find the current index in indexesToRemove vector?
数学の恋人
数学の恋人
Anonymous
Pavel
Hm, indexesToRemove is rather big, so the original vector, but it may worth it to convert it to unordered_map for example. Not sure, probably need to get more sleep :)
数学の恋人
Anonymous
数学の恋人
Anonymous
数学の恋人
Yes
I don't think that makes any difference there, pass by value or pass by reference does it really matter that much?
数学の恋人
Cengizhan
数学の恋人
Pavel
Yes. OK, I guess I will go with just iterate and erase and will think about it later. Thanks :)
数学の恋人
Please do tell us if you find anything efficient.
Pavel
Pavel
No, but I can sort it :)
数学の恋人
Pavel
Why?
Types like int can be passed using registers or stack. That's more efficient than passing a reference to it.
And there's another issue (I forgot how it called):
The compiler can be forced to generate code that reads variable from memory more often in case it can't be sure the variable you passed isn't changed inside your function.
Here is an example of such problem in a bad case.
https://en.m.wikipedia.org/wiki/Load-Hit-Store
数学の恋人
basically extra space
Pavel
That sounds like a very good solution (can't think if it could be done more efficient than this one), thanks
数学の恋人
oh right just reread the whole thing
数学の恋人
Yes
Thanks for the suggestion I corrected/recfactored it
Cengizhan
Anonymous
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in
@maths_lover
@cngzhnp
数学の恋人
数学の恋人
gone in my saved messages
Cengizhan
数学の恋人
is this okay to do?
int someFunc(const int, int*) { }
// Then calling like
int num = 0;
num = someFunc(num, &somePointerAddr);
Alex
yes
数学の恋人
or should I do like,
int num;
const int tempNum = 0;
num = someFunc(num, &someAddr);
Alex
Alex
first option is ok
数学の恋人
ok thanks
Wisenky
Guys , I want to build an rpg multiplayer cross-platform game with using cpp , I look at sdl sfml and unreal engine . Should I learn using a software like sdl for building it or an engine . Im so confused , would you lead me guys ?
Asdew
Do you want to make an engine and a game or just a game?
Wisenky
Asdew
Then you want to use a game engine.
klimi
Wisenky
Oh sad :(
klimi
I mean you could make your own game engine but... You would still use one
Asdew
Well, if you don't use a game engine that was not made specifically for your game, then you'll develop it along the way.
klimi
Exactly
Wisenky
Asdew
Well, not really hard.
Wisenky
Do you mean that I should use an engine that made before
Wisenky
Or making a new one specifically for mine
Wisenky
Wisenky
Thanks for your opinions guys
Asdew
Godot is better.
Dima
UE:)
Tokin
Thanks for your opinions guys
Just make an engine dude.. Might take years if you are asking the questions... But fun process.. You'll learn a lot..
Anonymous
Hi guys this may be off topic but then I would appreciate.
Does anyone know of a framework or api I can embed in a c# desktop app to track its analystics the way playstore tracks our Android apps.
数学の恋人
Lol banned quietly
@unchanted
gets, getchar, puts, putchar, getch, putch...
When, where and how to use them what is the difference in all these?
Which compiler understand which keyword...
Anonymous
Anonymous
@unchanted
Artöm
All of them are in standard library, none of them are keywords
@unchanted
Artöm
Yes
Artöm
The link https://en.cppreference.com/w/c/io