<blockquote>
<p>since we would still have to write an operator() for each possible TreeType</p>
</blockquote>

<p>Maybe template can help?</p>

<pre><code>class ReferenceSet: public boost::static_visitor&lt;void&gt;
{
public:
    template&lt;typename T&gt;
    void operator()(T *tree) const
    {
        tree-&gt;ReferenceSet();
    }  
};
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/issues/674#issuecomment-224364544">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFK7Q4q8ZTiTfXITf5gWmJyUZerjrks5qJbMGgaJpZM4It4UX">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFMuWQ0CDYf8tOv0p25zvFeG-K1klks5qJbMGgaJpZM4It4UX.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/674#issuecomment-224364544"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>