Ticket #5253 (closed Tasks: fixed)

Opened 6 years ago

Last modified 6 years ago

provide a const version of 'get_state'

Reported by: jan.vogelgesang@… Owned by: chenry
Milestone: Boost 1.47.0 Component: msm
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:


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 ;-) )

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.


Change History

comment:1 Changed 6 years ago by chenry

  • Status changed from new to closed
  • Version changed from Boost 1.45.0 to Boost 1.47.0
  • Resolution set to fixed
  • Milestone changed from To Be Determined to Boost 1.47.0

Fixed in trunk (70832). Will be merged in 1.47. Following is now possible:

void test(const player& p)
   const player_::Stopped& s1 = p.get_state<const player_::Stopped&>();
   s1.cfoo(); //const
   player_::Stopped& s2 = p.get_state<player_::Stopped&>();; // not const

   const player_::Stopped* sp1 = p.get_state<const player_::Stopped*>();
   sp1->cfoo(); //const
   player_::Stopped* sp2 = p.get_state<player_::Stopped*>();
   sp2->foo(); // not const

Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.