Changes in src/AST/Node.hpp [54e41b3:3648d98]
- File:
-
- 1 edited
-
src/AST/Node.hpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r54e41b3 r3648d98 9 9 // Author : Thierry Delisle 10 10 // Created On : Wed May 8 10:27:04 2019 11 // Last Modified By : A ndrew Beach12 // Last Modified On : Wed May 15 16:02:00 201913 // Update Count : 311 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed May 8 11:00:00 2019 13 // Update Count : 2 14 14 // 15 15 … … 76 76 // problems and be able to use auto return 77 77 template<typename node_t> 78 auto mutate( const node_t * node) {78 auto mutate(const node_t * node) { 79 79 assertf( 80 80 node->strong_count >= 1, … … 92 92 } 93 93 94 std::ostream& operator<< ( std::ostream& out, const Node * node );94 std::ostream& operator<< ( std::ostream& out, const Node* node ); 95 95 96 96 /// Base class for the smart pointer types … … 137 137 operator const node_t * () const { return node; } 138 138 139 /// wrapper for convenient access to dynamic_cast140 139 template<typename o_node_t> 141 140 const o_node_t * as() const { return dynamic_cast<const o_node_t *>(node); } 142 143 /// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere.144 /// Returns a mutable version of the pointer in this node.145 node_t * set_and_mutate( const node_t * n ) {146 // ensure ownership of `n` by this node to avoid spurious single-owner mutates147 assign( n );148 // get mutable version of `n`149 auto r = mutate( node );150 // re-assign mutable version in case `mutate()` produced a new pointer151 assign( r );152 return r;153 }154 141 155 142 using ptr = const node_t *;
Note:
See TracChangeset
for help on using the changeset viewer.