43 lines
1.0 KiB
Markdown
43 lines
1.0 KiB
Markdown
[any.observers]
|
|
|
|
# 22 General utilities library [[utilities]](./#utilities)
|
|
|
|
## 22.7 Storage for any type [[any]](any#observers)
|
|
|
|
### 22.7.4 Class any [[any.class]](any.class#any.observers)
|
|
|
|
#### 22.7.4.5 Observers [any.observers]
|
|
|
|
[ð](#lib:has_value,any)
|
|
|
|
`bool has_value() const noexcept;
|
|
`
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7505)
|
|
|
|
*Returns*: true if *this contains an object, otherwise false[.](#1.sentence-1)
|
|
|
|
[ð](#lib:type,any)
|
|
|
|
`const type_info& type() const noexcept;
|
|
`
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7516)
|
|
|
|
*Returns*: typeid(T) if *this has a contained value of type T,
|
|
otherwise typeid(void)[.](#2.sentence-1)
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7521)
|
|
|
|
[*Note [1](#note-1)*:
|
|
|
|
Useful for querying against types known either at compile time or only at runtime[.](#3.sentence-1)
|
|
|
|
â *end note*]
|