Boost C++ Libraries: Ticket #5253: provide a const version of 'get_state' https://svn.boost.org/trac10/ticket/5253 <p> The current implementation of 'get_state' doesn't compile when used on a const reference to a state machine. It would be nice to have a const version of 'get_state' (for people believing in 'const correctness' this is even an essential extension ;-) ) </p> <p> This ticket is opend as result of a discussion on the boost users list, subject "[Boost-users] [MSM] test if state machine is in a given state /const get_state" so i refer to this posting if further details are required. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5253 Trac 1.4.3 Christophe Henry Fri, 01 Apr 2011 20:13:08 GMT status, version, milestone changed; resolution set https://svn.boost.org/trac10/ticket/5253#comment:1 https://svn.boost.org/trac10/ticket/5253#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.45.0</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> </ul> <p> Fixed in trunk (70832). Will be merged in 1.47. Following is now possible: </p> <p> </p> <pre class="wiki">void test(const player&amp; p) { const player_::Stopped&amp; s1 = p.get_state&lt;const player_::Stopped&amp;&gt;(); s1.cfoo(); //const player_::Stopped&amp; s2 = p.get_state&lt;player_::Stopped&amp;&gt;(); s2.foo(); // not const const player_::Stopped* sp1 = p.get_state&lt;const player_::Stopped*&gt;(); sp1-&gt;cfoo(); //const player_::Stopped* sp2 = p.get_state&lt;player_::Stopped*&gt;(); sp2-&gt;foo(); // not const } </pre> Ticket