Azriel
Member
|
[solved] UID zero
Hi, it's me again Another day, another question.
Is the code below correct?
Code:
class A
{
A(UID& id = UID().zero())
{
//doing some stuff
}
}
Is that how it should be done if I want a default UID 0? I want to achieve something like a null in pointers, but with UID.
(This post was last modified: 11-05-2015 02:39 PM by Azriel.)
|
|
11-05-2015 01:09 PM |
|
Zervox
Member
|
RE: UID zero
There is a const object called UIDZero
so
A(UID& id = UIDZero){
|
|
11-05-2015 02:07 PM |
|
Azriel
Member
|
RE: UID zero
Uhm, but then it's a const and I cannot assign it to my UID& id.
Edit:
Is it ok to ConstCast it?
A(UID& id = ConstCast(UIDZero))
(This post was last modified: 11-05-2015 02:20 PM by Azriel.)
|
|
11-05-2015 02:14 PM |
|
Zervox
Member
|
RE: UID zero
Does the variable have to be non cost? can't you do const UID?
|
|
11-05-2015 02:23 PM |
|
Azriel
Member
|
RE: UID zero
Well, I'll try to change the code. Hope I don't mess it too much
Edit: Got it, thanks!
(This post was last modified: 11-05-2015 02:39 PM by Azriel.)
|
|
11-05-2015 02:28 PM |
|