mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: One::Is<TT>() const
git-svn-id: svn://ultimatepp.org/upp/trunk@7529 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6f946fedb6
commit
ffdaa8f26a
2 changed files with 10 additions and 1 deletions
|
|
@ -48,6 +48,9 @@ public:
|
|||
TT& Create() { TT *q = new TT; Attach(q); return *q; }
|
||||
T& Create() { T *q = new T; Attach(q); return *q; }
|
||||
|
||||
template <class TT>
|
||||
bool Is() const { return dynamic_cast<const TT *>(ptr); }
|
||||
|
||||
bool IsPicked() const { return ptr == (T*)1; }
|
||||
bool IsEmpty() const { Chk(); return !ptr; }
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,12 @@ it.&]
|
|||
[s7;%% [*/ Return value]-|Reference to actual content (of type TT).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:One`:`:Is`(`)const: [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 TT]>_[@(0.0.255) bool
|
||||
]_[* Is]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns true if One contains object of type [%-*@4 TT] or derived
|
||||
from [%-*@4 TT]. [%-*@4 T] must be polymorphic.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:One`:`:IsEmpty`(`)const: [@(0.0.255) bool]_[* IsEmpty]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns [* true] if there is no content.&]
|
||||
[s3; &]
|
||||
|
|
@ -152,4 +158,4 @@ it.&]
|
|||
[s5;:One`:`:operator bool`(`)const: [* operator_bool]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns [* true] if there is content.&]
|
||||
[s3;%% &]
|
||||
[s0; ]
|
||||
[s0; ]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue