BinaryByter
but which error?
Mihail
Reference of reference makes 0 sense
Mihail
No
MᏫᎻᎯᎷᎷᎬᎠ
Yeah
MᏫᎻᎯᎷᎷᎬᎠ
how about you try it with (int&)& a = 1;?
Does types have these kind of things like operators expressions
BinaryByter
brackets work everywhere
MᏫᎻᎯᎷᎷᎬᎠ
brackets work everywhere
I didn't know that
BinaryByter
you didn't know about &(*iterator) ?
MᏫᎻᎯᎷᎷᎬᎠ
So function pointers
MᏫᎻᎯᎷᎷᎬᎠ
you didn't know about &(*iterator) ?
Returns the address of the member variable in class "iterator"
BinaryByter
yes
BinaryByter
but it uses brackets
MᏫᎻᎯᎷᎷᎬᎠ
Right?
BinaryByter
outside of operator expressions
MᏫᎻᎯᎷᎷᎬᎠ
but it uses brackets
It doesn't need to
MᏫᎻᎯᎷᎷᎬᎠ
Like
BinaryByter
&(*iterator).call()
MᏫᎻᎯᎷᎷᎬᎠ
int &* is valid
BinaryByter
wouldnt work without the bracket
MᏫᎻᎯᎷᎷᎬᎠ
wouldnt work without the bracket
Wouldn't work at all
MᏫᎻᎯᎷᎷᎬᎠ
yeah
BinaryByter
sorry
BinaryByter
I meant
BinaryByter
->
BinaryByter
&(*iterator)->call()
MᏫᎻᎯᎷᎷᎬᎠ
lmao
BinaryByter
(yes, I know that iterators have operator-> overloaded, but thats not the point)
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
So
MᏫᎻᎯᎷᎷᎬᎠ
Rvalue can be in left-hand
BinaryByter
rvalue references
MᏫᎻᎯᎷᎷᎬᎠ
But only can hold temorary values
MᏫᎻᎯᎷᎷᎬᎠ
rvalue references
So there's a difference between revalue reference and rvalue
BinaryByter
well yes
BinaryByter
read this
MᏫᎻᎯᎷᎷᎬᎠ
If I knew that I wouldn't ask
BinaryByter
If I knew that I wouldn't ask
you already read the article mihail just sent
MᏫᎻᎯᎷᎷᎬᎠ
read this
Yeah I read it
BinaryByter
does 1 = 2 work?
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
theres your answer
MᏫᎻᎯᎷᎷᎬᎠ
Yeah
MᏫᎻᎯᎷᎷᎬᎠ
Thank you guys
MᏫᎻᎯᎷᎷᎬᎠ
I hope I wasn't a pain in the ass xD
olli
int& r = 1;
this is indeed not valid, running it would have shown the error. Your reference needs to be const for it to work.
olli
Even it's valid The question is Why it can be changed?
An R-Value reference is often used to move from an object, hence you need to change it.
Anonymous
What's the best C++ idle?
olli
What's the best C++ idle?
http://blog.davidecoppola.com/2018/02/market-share-most-used-c-cpp-ides-in-2018-statistics-estimates/
Anonymous
C++ for exploit development and IOT?what's the scope?😶😶
Anonymous
Hi
Anonymous
del.dog
Anonymous
del.dog
Guys Use this site to send ur code. Its more convenient
Parra
class Foo { public: Foo &f(); Foo &g(); Foo &h(); }; foo (Foo &x ) { x.f().g().h(); }
Parra
👍
MᏫᎻᎯᎷᎷᎬᎠ
An R-Value reference is often used to move from an object, hence you need to change it.
What is the relation between moving from an object and changing it?
olli
What is the relation between moving from an object and changing it?
Move constructors/assignment typically "steal" resources held by the moved from object. Since you "steal" them you change the object you move from, so it can't be const. That's why the parameter to a move constructor or the move assignment operator is not const. The moved from object is left in a valid but indeterminate state.
MᏫᎻᎯᎷᎷᎬᎠ
You can't steal from a constant storage
MᏫᎻᎯᎷᎷᎬᎠ
Thank you🙌
olli
Thank you🙌
Welcome :)
olli
I didn't get the last point Is left in a valid but indeterminate state
Well, if you move from a string or a vector it's likely the vector is empty afterwards but you shall never rely on it
MᏫᎻᎯᎷᎷᎬᎠ
How about indeterminate state
olli
Yeah Cuz it will be destroyed soon enough
a moved from object does not to be destroyed before the object moved to
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Not the moved
olli
Not the moved
a move does not mean the object will be destroyed
BinaryByter
it will be kinda broken tho
MᏫᎻᎯᎷᎷᎬᎠ
a move does not mean the object will be destroyed
I know that What I meant the object will be destroyed soon enough (once it gets out of scope)
MᏫᎻᎯᎷᎷᎬᎠ
it will be kinda broken tho
Yes When you steal the content of the object
BinaryByter
Yes
olli
it will be kinda broken tho
valid but in indeterminated state
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
so using it again is UB or does move make sure that vector gets a new buffer?
MᏫᎻᎯᎷᎷᎬᎠ
valid but in indeterminated state
If you foolishly used it will cause ub?