kpeeters / tree.hh

An STL-like C++ header-only tree library
GNU General Public License v3.0
132 stars 31 forks source link

Unable to override swap function call in append_child #25

Open rp999 opened 6 months ago

rp999 commented 6 months ago

iter tree<T, tree_node_allocator>::append_child(iter position, T&& x) contains std::swap(tmp->data, x); which enforces the use of std::swap. In my instance I needed to control how the data fields are swapped based on information they contain. By changing the std::swap call to these 2 statements, I can provide an override swap function: using std::swap; swap(tmp->data, x); If no override function is provided, the default std::swap is used.