{ "format": 1, "id": "saw-ptr", "kind": "class", "name": "ptr", "namespace": "saw", "module": "core", "header": "modules/core/c++/common.hpp", "brief_description": "Non owning pointer which may be empty.", "detailed_description": [ [ "States in the type system that something is referred to but not owned. Copyable and reassignable, unlike", {"name": "ref", "id": "saw-ref"}, "and checkable, unlike a reference." ], [ "Dereferencing goes through the call operator rather than through star or arrow, which keeps the indirection visible at every use." ], [ "Nothing here tracks lifetime. A ptr outliving its target is a bug the type cannot catch, which is why the classes holding one, such as the data servers, forbid moving themselves." ] ], "templates": [ {"name": "T", "kind": "type"} ], "attributes": { "saw-ptr-ptr_": { "id": "saw-ptr-ptr_", "name": "ptr_", "type": ["T *"], "visibility": "private" } }, "functions": { "saw-ptr-ctor-1": { "id": "saw-ptr-ctor-1", "name": "ptr", "type": [], "brief_description": "Empty." }, "saw-ptr-ctor-2": { "id": "saw-ptr-ctor-2", "name": "ptr", "type": [], "brief_description": "Pointing at an object. Implicit, so passing an object where a ptr is expected just works.", "parameters": [ {"name": "ptr__", "type": ["T &"]} ] }, "saw-ptr-call": { "id": "saw-ptr-call", "name": "operator()", "type": ["T &"], "brief_description": "The pointed at object. Undefined if empty." }, "saw-ptr-is_valid": { "id": "saw-ptr-is_valid", "name": "is_valid", "type": ["bool"], "const": true, "brief_description": "Whether it points at anything." } } }