Skip to content

Instantly share code, notes, and snippets.

@Jakz
Created December 30, 2014 17:41
Show Gist options
  • Save Jakz/e8166edf453c6f2c9630 to your computer and use it in GitHub Desktop.
Save Jakz/e8166edf453c6f2c9630 to your computer and use it in GitHub Desktop.
template<typename T>
void Visitor::dispatchAndReplace(unique_ptr<T>& ptr)
{
if (ptr)
{
Node* node = dispatch(ptr.get());
T* cnode = dynamic_cast<T*>(node);
if (cnode)
ptr.reset(cnode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment