Skip to content

Commit 69a27d3

Browse files
committed
Updating README
1 parent b9c584d commit 69a27d3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ auto & vec = boxedValue<std::vector<int>>(obj1);
259259
assert(vec.size() == 3);
260260
assert(vec[1] == 2);
261261
262+
//If you aren't sure whether the object is a boxed value of a certain
263+
//type you can check-and-get it by pointer. This will return nullptr
264+
//on failure
265+
if (auto * vec = addressOfBoxedValue<std::vector<int>>(obj1)) {
266+
assert(vec->size() == 3);
267+
assert((*vec)[1] == 2);
268+
}
269+
262270
//The reference you get back is mutable by default. If you want immutability do this:
263271
NSObject * immutableObj = box<const std::vector<int>>(...any of the stuff above...);
264272

0 commit comments

Comments
 (0)