Augmented
Python is really helpful. You should give it more tries
I like it too, but I have something like phobia of using third party libraries and stock code... the "import" and "using" keywords for a foreign code are still so scary to me...
Anonymous
Why don't you use smart pointers?
Augmented
Why don't you use smart pointers?
I have no idea, what is that?
Anonymous
I have no idea, what is that?
Well, you definitely need to learn about it
Anonymous
Using raw pointers in modern C++ is mostly bad practice
Augmented
Using raw pointers in modern C++ is mostly bad practice
Is it wrapper class for pointer with an operator overload ?
Augmented
Yes
That's makes sense now, I have learned about, but never dare to use... I will try now...
Francisco
Using raw pointers in modern C++ is mostly bad practice
There're a few use cases, but smart ones should be the first one to be considered
Anonymous
That's makes sense now, I have learned about, but never dare to use... I will try now...
Read Meyers book — Effective modern C++ He shows how to use them properly
MᏫᎻᎯᎷᎷᎬᎠ
Augmented
Of course But I said — mostly
I am rereading it just now, thank you so much for pointing me that... Any advice on this header only library, i have worked on it tonight... https://godbolt.org/z/DCfb2F
Francisco
Read Meyers book — Effective modern C++ He shows how to use them properly
Also, most of the times unique_ptr is the best option
Francisco
But also much faster
There's always a drawback
MᏫᎻᎯᎷᎷᎬᎠ
There's always a drawback
That's why use it when you are certain that it will be deleted safely and convenient
Anonymous
But also much faster
unique_ptr is as fast as raw pointer in 99% times And I think it's a normal cost to avoid memory leaks and enhance code readability
MᏫᎻᎯᎷᎷᎬᎠ
Ludovic 'Archivist'
unique_ptr is as fast as raw pointer in 99% times And I think it's a normal cost to avoid memory leaks and enhance code readability
It is complicated. unique_ptr is about as fast and simple as a normal pointer in a no_except context but may have copy overhead and is not a trivial type
Ilya
is this better, or not?
This is wrong singleton...
Ilya
hello everybody, is ternary operator, more readable, than if/else ?
? operator -- is an expression. IF is statement. They are completely different.
Augmented
nullptr is built in
https://godbolt.org/z/pm0c18 What do you think? should i get rid of raw pointers, and switch to smart? And what's better to use for callbacks? How to impement singleton for ATimers in a proper way?
Dima
/ban Gtfo
Bojan_Krdemn
Hун! Working on a N-gram algorithm. The task is to make a map from the set of all (n1,n2,n3... n-1) words to the set of Nth words that follow the set of (n-1). Which collection should i choose to represent the set of (n-1). Doublicates must be allowed, thus set is not an option. Stack? List? Vector?
Bojan_Krdemn
Vector? Not likely, it is more likely the image of map, rather then domain
Bojan_Krdemn
for i should choose n-th word arbitrary based on probability p
Bojan_Krdemn
interesting. perhaps yes. if it had not existed what would have been my choice?
Anonymous
😊
Bojan_Krdemn
map( key, vector(value) )
domain of the map (key) being what? either string or queue
Bojan_Krdemn
string - may be but complicated addition of the last word and removal of the first word
olli
@BOND_0O7 @unterumarmung @urinal In case you're interested, In the middle part the overhead of unique pointer is analyzed. https://youtu.be/rHIkrotSwcc
Bojan_Krdemn
which push me to think about queue
Sachin
Can anyone help in (mobile price ) question in div 2
Dima
What the..
Anonymous
Ilya
domain of the map (key) being what? either string or queue
map< string, vector <string>>
Bojan_Krdemn
i also think dequeue, remove from tail and add to head
Bojan_Krdemn
which is what needed (intuitively, didn't study rigorous alg analysis) to build chain of words one yb one
Ilya
i also think dequeue, remove from tail and add to head
Dequeue eats more memory, vector is slow in adding. But you must know number of trigramms for this particular word ,beforehand, so vector will do
> dni9
hey anyone knows , how to get the first n last digit from a 3 digit integer ? thank you !
> dni9
like 398 > 38
Artöm
/ 100 and % 10
> dni9
as a integer not a single digit
David🇨🇺ElChino
Artöm
n / 100 * 10 + n % 10
> dni9
Pratham
Can anybody tell me why I'm getting that binary like code inside that box?
Pratham
Program: Conversion of Infix expression to postfix expression using C
Pratham
Platform: Ubuntu terminal.
Pratham
I should actually get + in that place
Anonymous
Can anybody tell me why I'm getting that binary like code inside that box?
/warn read the rules (picture of screen + bad problem description with no code)
Pratham
I apologise.
Pratham
I didn't know this new rule
Anonymous
I didn't know this new rule
Not knowing doesn't free you from punishment You should have read the rules in the pinned message
Pratham
Cool cool
Pratham
I'm not asking to remove warn.
Pratham
I'm saying I'm sorry. Coz I didn't read rules
Pratham
/warn read the rules (picture of screen + bad problem description with no code)
When u started typing itself I came to know...it's either a warn..or a troll🤣lol
Pratham
Am I allowed to ask that?😅
Pavel
Am I allowed to ask that?😅
It's hard to say without code
Pratham
Okay. I understand.
Pratham
Will send code through Pastebin