1 parent b9c584d commit 69a27d3Copy full SHA for 69a27d3
1 file changed
README.md
@@ -259,6 +259,14 @@ auto & vec = boxedValue<std::vector<int>>(obj1);
259
assert(vec.size() == 3);
260
assert(vec[1] == 2);
261
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
+
270
//The reference you get back is mutable by default. If you want immutability do this:
271
NSObject * immutableObj = box<const std::vector<int>>(...any of the stuff above...);
272
0 commit comments