<p>I think it is possible if you do not wish to change the public api, you can construct the boost::variant based on the enum. This way, there is only one place need to use the if else, other operations can rely on the visitor.</p>

<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-224324167">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFPhezMyknxrMu9OGjWf_1vDjMbMgks5qJZMGgaJpZM4It4UX">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEs4HCIbeUnxemjNJtAJp1CLd5zzks5qJZMGgaJpZM4It4UX.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-224324167"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>