About Store Forum Documentation Contact



Post Reply 
[solved] UID zero
Author Message
Azriel Offline
Member

Post: #1
[solved] UID zero
Hi, it's me again wink 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
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: UID zero
There is a const object called UIDZero
so
A(UID& id = UIDZero){
11-05-2015 02:07 PM
Find all posts by this user Quote this message in a reply
Azriel Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: UID zero
Does the variable have to be non cost? can't you do const UID?
11-05-2015 02:23 PM
Find all posts by this user Quote this message in a reply
Azriel Offline
Member

Post: #5
RE: UID zero
Well, I'll try to change the code. Hope I don't mess it too much grin

Edit: Got it, thanks!
(This post was last modified: 11-05-2015 02:39 PM by Azriel.)
11-05-2015 02:28 PM
Find all posts by this user Quote this message in a reply
Post Reply