The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
unit_map Class Reference

Container associating units to locations. More...

#include <map.hpp>

Classes

struct  const_iter_types
 
struct  iterator_base
 
struct  standard_iter_types
 
struct  unit_pod
 The pointer to the unit and a reference counter to record the number of extant iterators pointing to this unit. More...
 

Public Types

typedef iterator_base
< standard_iter_types
unit_iterator
 
typedef iterator_base
< const_iter_types
const_unit_iterator
 
typedef unit_iterator iterator
 
typedef const_unit_iterator const_iterator
 
using umap_retval_pair_t = std::pair< unit_iterator, bool >
 

Public Member Functions

 unit_map ()
 
 unit_map (const unit_map &that)
 
unit_mapoperator= (const unit_map &that)
 
 ~unit_map ()
 
void swap (unit_map &o)
 
unit_iterator find (size_t id)
 
unit_iterator find (const map_location &loc)
 
const_unit_iterator find (const map_location &loc) const
 
const_unit_iterator find (size_t id) const
 
unit_iterator find_leader (int side)
 
const_unit_iterator find_leader (int side) const
 
unit_iterator find_first_leader (int side)
 
std::vector< unit_iteratorfind_leaders (int side)
 
std::vector< const_unit_iteratorfind_leaders (int side) const
 
size_t count (const map_location &loc) const
 
unit_iterator begin ()
 
const_unit_iterator begin () const
 
unit_iterator end ()
 
const_unit_iterator end () const
 
size_t size () const
 
size_t num_iters () const
 
bool empty () const
 
void clear (bool force=false)
 
umap_retval_pair_t add (const map_location &l, const unit &u)
 Adds a copy of unit u at location l of the map. More...
 
umap_retval_pair_t insert (unit_ptr p)
 Inserts the unit pointed to by p into the map. More...
 
umap_retval_pair_t move (const map_location &src, const map_location &dst)
 Moves a unit from location src to location dst. More...
 
umap_retval_pair_t replace (const map_location &l, unit_ptr p)
 Works like unit_map::add; but l is emptied first, if needed. More...
 
size_t erase (const map_location &l)
 Erases the unit at location l, if any. More...
 
template<typename T >
size_t erase (const T &iter)
 Erases a unit given by a pointer or an iterator. More...
 
unit_ptr extract (const map_location &loc)
 Extracts a unit from the map. More...
 
bool self_check () const
 Checks invariants. More...
 
bool has_unit (const unit *const u) const
 Is the unit in the map? More...
 
bool has_unit_at (const map_location &loc) const
 Tests whether a unit exists at the given location. More...
 

Private Types

typedef std::map< size_t,
unit_pod
umap
 
typedef std::unordered_map
< map_location, umap::iterator > 
lmap
 Map of location to umap iterator. More...
 

Private Member Functions

umap::iterator begin_core () const
 
bool is_valid (const umap::const_iterator &i) const
 
bool is_valid (const lmap::const_iterator &i) const
 
bool is_found (const umap::const_iterator &i) const
 
bool is_found (const lmap::const_iterator &i) const
 
template<typename X >
unit_map::unit_iterator make_unit_iterator (X const &i)
 
template<typename X >
unit_map::const_unit_iterator make_const_unit_iterator (X const &i) const
 

Private Attributes

umap umap_
 underlying_id -> unit_pod. More...
 
lmap lmap_
 location -> umap::iterator. More...
 

Detailed Description

Container associating units to locations.

The indirection location -> underlying_id -> unit ensures that iterators stay valid even if WML modifies or moves units on the fly. They even stay valid if a unit is erased from the map and another unit with the same underlying id is inserted in the map. In other words, it is a doubly indexed ordered map with persistent iterators (that never invalidate).

Note
The unit_map is implemented as 2 maps: an unordered map that stores iterators from the ordered map of reference-counted pointers to units.

The unordered map provides O(1) find times. The ordered map ensures ordering of units by underlying_id. The reference counting is what guarantees the persistent iterators. Storing an iterator only prevents that dead unit's id-map entry from being recovered.

Note
Prefered usages for tight loops follows:

Use the std::pair<iterator, bool> format which checks the preconditions and returns false (second) to indicate failure and no change to the unit_map. True indicates success along with the new iterator (first).

Storing the result iterator prevents the old iterator from entering the fallback recovery code. This is faster than the old methodology of find to check if empty, insert, and then find to check for success. It is the same method as std::map uses, the C++ way.


unit_iterator i; //results are stored here

ADD: std::pair<unit_iterator, bool> try_add(units->add(loc, unit)); if(try_add.second) { i = try_add.first; }

MOVE: std::pair<unit_iterator, bool> try_add(units->move(src, dst)); if(try_add.second) { i = try_add.first; }

INSERT: std::pair<unit_iterator, bool> try_add(units->insert(unitp)); if(try_add.second) { i = try_add.first; }

REPLACE (preferred over erase and then add) std::pair<unit_iterator, bool> try_add(units->move(loc, unit)); if(try_add.second){ i = try_add.first; }


Note
The previous implementation was 2 binary tree based maps: a location map pointing to another. Lookups were O(2*log(N)) and O(log(N)). Order was implicit in the id map choosen as the base. Persistence was provided by reference counting all iterators collectively and only recovering space when there were no iterators outstanding. Even 1 iterator being stored caused a leak, because all space for dead units was not recovered.
Units are owned by the container.
The indirection does not involve map lookups whenever an iterator is dereferenced, it just causes a pointer indirection. The downside is that incrementing iterators is not O(1).
The code does not involve any magic, so units moved while being iterated upon may be skipped or visited twice.
Iterators prevent ghost units from being collected, so they should never be stored in data structures, as it will cause slowdowns!
By popular demand iterators are effectively permanent. They are handles and not iterators. Any access might cause a full lookup. Keeping iterators around holds onto memory.

Definition at line 99 of file map.hpp.

Member Typedef Documentation

Definition at line 372 of file map.hpp.

Definition at line 368 of file map.hpp.

Definition at line 371 of file map.hpp.

typedef std::unordered_map<map_location, umap::iterator> unit_map::lmap
private

Map of location to umap iterator.

Definition at line 123 of file map.hpp.

typedef std::map<size_t, unit_pod> unit_map::umap
private

Definition at line 120 of file map.hpp.

using unit_map::umap_retval_pair_t = std::pair<unit_iterator, bool>

Definition at line 439 of file map.hpp.

Definition at line 367 of file map.hpp.

Constructor & Destructor Documentation

unit_map::unit_map ( )

Definition at line 31 of file map.cpp.

unit_map::unit_map ( const unit_map that)

Definition at line 37 of file map.cpp.

References add(), begin(), end(), and i.

unit_map::~unit_map ( )

Definition at line 61 of file map.cpp.

References clear().

Member Function Documentation

unit_map::umap_retval_pair_t unit_map::add ( const map_location l,
const unit u 
)

Adds a copy of unit u at location l of the map.

Returns
A pair consisting of an iterator pointing to the new unit (or the unit already occupying that location) and a bool indicating success.
Note
It is 3 times as fast to attempt to insert a unit at l and check for success than it is to verify that the location is empty, insert the unit, and then check the location for the unit.

Definition at line 78 of file map.cpp.

References insert(), p, and self_check().

Referenced by BOOST_AUTO_TEST_CASE(), editor::map_context::load_scenario(), editor::editor_action_unit::perform_without_undo(), temporary_unit_placer::temporary_unit_placer(), and unit_map().

unit_iterator unit_map::begin ( )
inline
const_unit_iterator unit_map::begin ( ) const
inline

Definition at line 410 of file map.hpp.

References begin_core(), and make_const_unit_iterator().

unit_map::umap::iterator unit_map::begin_core ( ) const
private

Definition at line 66 of file map.cpp.

References i, self_check(), and umap_.

Referenced by begin().

void unit_map::clear ( bool  force = false)

Definition at line 253 of file map.cpp.

References DBG_NG, i, is_valid(), lmap_, num_iters(), and umap_.

Referenced by ~unit_map().

size_t unit_map::count ( const map_location loc) const
inline
bool unit_map::empty ( ) const
inline
unit_iterator unit_map::end ( )
inline

Definition at line 415 of file map.hpp.

References make_unit_iterator(), and umap_.

Referenced by unit::ability_active(), ai::ai_default_rca::move_to_targets_phase::access_points(), scoped_xy_unit::activate(), ai::attack_analysis::analyze(), ai::ai_default_rca::aspect_attacks_base::analyze_targets(), wb::move::apply_temp_modifier(), backstab_check(), BOOST_AUTO_TEST_CASE(), ai::readonly_context_impl::calculate_moves(), editor::editor_controller::can_execute_command(), editor::editor_controller::change_unit_id(), actions::check_recall_location(), actions::check_recruit_location(), wb::attack::check_validity(), ai::ai_default_rca::move_to_targets_phase::choose_move(), actions::shroud_clearer::clear_unit(), editor::mouse_action_unit::click_left(), wfl::attack_map_callable::collect_possible_attacks(), events::menu_handler::continue_move(), ai::default_ai_context_impl::count_free_hexes_in_castle(), events::menu_handler::current_unit(), events::mouse_handler::cycle_units(), wfl::gamestate::DEFINE_WFL_FUNCTION(), ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), ai::stage_unit_formulas::do_play_stage(), events::console_handler::do_unit(), editor::mouse_action_unit::drag_end_left(), display::draw_invalidated(), game_display::draw_movement_info(), preferences::encounter_start_units(), events::menu_handler::end_unit_turn(), ai::ai_default_rca::goto_phase::evaluate(), wfl::move_candidate_action::evaluate(), wfl::attack_candidate_action::evaluate(), ai::ai_default_rca::get_healing_phase::evaluate(), ai::ai_default_rca::retreat_phase::evaluate(), ai::ai_default_rca::get_villages_phase::execute(), ai::ai_default_rca::leader_shares_keep_phase::execute(), ai::attack_analysis::execute_self(), wfl::set_unit_var_callable::execute_self(), game_events::wml_event_pump::filter_event(), wb::find_backup_leader(), find_first_leader(), find_leader(), find_leaders(), ai::default_ai_context_impl::find_targets(), events::mouse_handler::find_unit(), pathfind::find_vacant_tile(), game_board::find_visible_unit(), actions::shroud_clearer::fire_events(), unit_filter::first_match_on_map(), footsteps_images(), ai::ai_default_rca::move_to_targets_phase::form_group(), unit::get_abilities(), unit::get_ability_bool(), tod_manager::get_illuminated_time_of_day(), gui2::dialogs::game_stats::get_leader(), actions::get_recalls(), actions::get_recruits(), gui2::dialogs::get_title_suffix(), wfl::attack_map_callable::get_value(), ai::formula_ai::get_value(), ai::ai_default_rca::get_villages_phase::get_villages(), game_board::get_visible_unit(), has_unit_at(), game_board::heal_all_survivors(), ai::impl_ai_aspect_get(), impl_unit_type_next(), ai::default_recruitment::recruitment::is_enemy_in_radius(), pathfind::mark_route(), editor::mouse_action_unit::move(), ai::ai_default_rca::move_to_targets_phase::move_group(), actions::move_unit_and_record(), wb::manager::on_mouseover_change(), unit_map::iterator_base< iter_types >::operator++(), editor::editor_action_unit_delete::perform(), editor::editor_action_unit_facing::perform_without_undo(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::move_to_targets_phase::rate_group(), editor::editor_controller::rename_unit(), game_board::replace_map(), actions::move_unit_spectator::reset(), unit_display::reset_helpers(), events::mouse_handler::select_hex(), ai::formula_ai::shortest_path_calculator(), gui2::dialogs::unit_mode_controller::show_list(), gui2::dialogs::show_unit_list(), gui2::dialogs::team_mode_controller::show_units(), game_state::side_can_recruit_on(), attack_type::special_active(), editor::map_context::to_config(), under_leadership(), actions::undo::recruit_action::undo(), actions::undo::recall_action::undo(), actions::undo::move_action::undo(), editor::editor_controller::unit_description(), events::menu_handler::unit_hold_position(), unit_map(), unit_display::unit_recruited(), unit_map::iterator_base< iter_types >::valid_entry(), unit_map::iterator_base< iter_types >::valid_exit(), and verify().

const_unit_iterator unit_map::end ( ) const
inline

Definition at line 420 of file map.hpp.

References make_const_unit_iterator(), and umap_.

size_t unit_map::erase ( const map_location l)
template<typename T >
size_t unit_map::erase ( const T &  iter)

Erases a unit given by a pointer or an iterator.

Precondition
The unit is on the map.

Definition at line 588 of file map.hpp.

References erase().

unit_ptr unit_map::extract ( const map_location loc)

Extracts a unit from the map.

The unit is no longer owned by the map. It can be reinserted later, if needed.

Definition at line 268 of file map.cpp.

References DBG_NG, i, lmap_, self_check(), and umap_.

Referenced by ai::attack_analysis::analyze(), wb::suppose_dead::apply_temp_modifier(), BOOST_AUTO_TEST_CASE(), erase(), game_lua_kernel::intf_extract_unit(), wb::recall::remove_temp_modifier(), and wb::recruit::remove_temp_modifier().

unit_map::unit_iterator unit_map::find ( size_t  id)

Definition at line 311 of file map.cpp.

References i, self_check(), and umap_.

Referenced by unit::ability_active(), ai::ai_default_rca::move_to_targets_phase::access_points(), scoped_xy_unit::activate(), unit_creator::add_unit(), replay::add_unit_checksum(), advance_unit(), advance_unit_at(), ai::attack_analysis::analyze(), wb::move::apply_temp_modifier(), attack_unit_and_advance(), backstab_check(), battle_context::battle_context(), ai::readonly_context_impl::best_defensive_position(), BOOST_AUTO_TEST_CASE(), editor::editor_controller::can_execute_command(), events::menu_handler::change_side(), editor::editor_controller::change_unit_id(), ai::readonly_context_impl::check_attack_action(), actions::check_recall_location(), actions::check_recruit_location(), wb::attack::check_validity(), wb::move::check_validity(), wb::suppose_dead::check_validity(), ai::ai_default_rca::move_to_targets_phase::choose_move(), actions::shroud_clearer::clear_unit(), editor::mouse_action_unit::click_left(), wfl::attack_map_callable::collect_possible_attacks(), events::menu_handler::continue_move(), ai::default_ai_context_impl::count_free_hexes_in_castle(), wfl::gamestate::DEFINE_WFL_FUNCTION(), ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), ai::recall_result::do_check_after(), ai::recruit_result::do_check_after(), ai::stopunit_result::do_check_after(), ai::attack_result::do_check_before(), ai::attack_result::do_execute(), ai::move_result::do_execute(), ai::stopunit_result::do_execute(), do_replay_handle(), events::menu_handler::do_search(), editor::mouse_action_unit::drag_end_left(), display::draw_invalidated(), game_display::draw_movement_info(), events::menu_handler::end_unit_turn(), ai::ai_default_rca::goto_phase::evaluate(), ai::ai_default_rca::move_leader_to_keep_phase::evaluate(), ai::ai_default_rca::get_healing_phase::evaluate(), wb::attack::execute(), wb::move::execute(), ai::ai_default_rca::get_villages_phase::execute(), ai::ai_default_rca::leader_shares_keep_phase::execute(), ai::readwrite_context_impl::execute_attack_action(), editor::editor_controller::execute_command(), ai::attack_analysis::execute_self(), wfl::set_unit_var_callable::execute_self(), game_events::wml_event_pump::filter_event(), find(), game_board::find_unit(), pathfind::find_vacant_tile(), ai::ai_default_rca::get_villages_phase::find_villages(), game_board::find_visible_unit(), actions::shroud_clearer::fire_events(), footsteps_images(), ai::ai_default_rca::move_to_targets_phase::form_group(), lua_unit::get(), unit::get_abilities(), unit::get_ability_bool(), editor::editor_controller::get_action_state(), tod_manager::get_illuminated_time_of_day(), actions::get_recalls(), actions::get_recruits(), lua_unit::get_shared(), wb::manager::get_temp_move_unit(), wb::suppose_dead::get_unit(), game_events::entity_location::get_unit(), wb::move::get_unit(), ai::move_result::get_unit(), ai::stopunit_result::get_unit(), display_context::get_visible_unit(), has_unit_at(), game_board::has_visible_unit(), ai::helper_advance_unit(), impl_unit_type_next(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_get_unit(), game_lua_kernel::intf_teleport(), ai::default_recruitment::recruitment::is_enemy_in_radius(), luaW_pushfaivariant(), pathfind::mark_route(), terrain_filter::match_internal(), unit_animation::matches(), wb::move::move(), editor::mouse_action_unit::move(), ai::ai_default_rca::move_to_targets_phase::move_group(), events::mouse_handler::move_unit_along_route(), actions::move_unit_and_record(), wb::manager::on_mouseover_change(), editor::editor_action_unit_delete::perform(), editor::editor_action_unit::perform_without_undo(), editor::editor_action_unit_replace::perform_without_undo(), editor::editor_action_unit_facing::perform_without_undo(), wb::manager::post_draw(), ai::readonly_context_impl::power_projection(), wb::manager::pre_draw(), lua_unit::put_map(), ai::ai_default_rca::move_to_targets_phase::rate_group(), wb::suppose_dead::remove_temp_modifier(), wb::move::remove_temp_modifier(), editor::editor_controller::rename_unit(), unit_display::reset_helpers(), game_lua_kernel::run_filter(), events::mouse_handler::select_hex(), wb::highlighter::set_mouseover_hex(), ai::formula_ai::shortest_path_calculator(), events::mouse_handler::show_attack_dialog(), events::mouse_handler::show_attack_options(), game_state::side_can_recruit_on(), ai::simulated_attack(), ai::simulated_stopunit(), attack_type::special_active(), wb::suppose_dead::suppose_dead(), SYNCED_COMMAND_HANDLER_FUNCTION(), pathfind::teleport_map::teleport_map(), under_leadership(), actions::undo::recall_action::undo(), actions::undo::recruit_action::undo(), actions::undo::move_action::undo(), unit_display::unit_attack(), display_context::unit_can_move(), editor::editor_controller::unit_description(), events::menu_handler::unit_hold_position(), unit_display::unit_recruited(), verify(), pathfind::vision_path::vision_path(), and display_context::would_be_discovered().

unit_map::unit_iterator unit_map::find ( const map_location loc)

Definition at line 323 of file map.cpp.

References lmap_, and self_check().

const_unit_iterator unit_map::find ( const map_location loc) const
inline

Definition at line 377 of file map.hpp.

References find().

const_unit_iterator unit_map::find ( size_t  id) const
inline

Definition at line 382 of file map.hpp.

References find().

unit_map::unit_iterator unit_map::find_first_leader ( int  side)

Definition at line 341 of file map.cpp.

References begin(), end(), and i.

unit_map::unit_iterator unit_map::find_leader ( int  side)
const_unit_iterator unit_map::find_leader ( int  side) const
inline

Definition at line 389 of file map.hpp.

References find_leader().

std::vector< unit_map::unit_iterator > unit_map::find_leaders ( int  side)
std::vector< unit_map::const_unit_iterator > unit_map::find_leaders ( int  side) const

Definition at line 371 of file map.cpp.

References find_leaders().

bool unit_map::has_unit ( const unit *const  u) const

Is the unit in the map?

Precondition
u != nullptr
Parameters
uPointer to the unit to find.
Returns
True if found, false otherwise.

Definition at line 431 of file map.cpp.

References umap_.

bool unit_map::has_unit_at ( const map_location loc) const

Tests whether a unit exists at the given location.

Definition at line 444 of file map.cpp.

References end(), and find().

unit_map::umap_retval_pair_t unit_map::insert ( unit_ptr  p)

Inserts the unit pointed to by p into the map.

If insertion into either the unit or location map fails, all operations are reverted.

The one oddity is that to facilitate non-invalidating iterators, the list sometimes has nullptr pointers which should be used when they correspond to uids previously used.

Returns
A pair consisting of an iterator pointing to the new unit (or the unit already occupying that location) and a bool indicating success.
Note
It is 3 times as fast to attempt to insert a unit at l and check for success than it is to verify that the location is empty, insert the unit, and then check the location for the unit.
If the unit::underlying_id is already in use, a new one will be generated.
The map takes ownership of the pointed object only if the operation succeeds.

Definition at line 135 of file map.cpp.

References DBG_NG, ERR_NG, error(), lmap_, make_unit_iterator(), unit::name(), p, unit_map::unit_pod::ref_count, self_check(), umap_, unit_map::unit_pod::unit, and map_location::valid().

Referenced by add(), advance_unit(), ai::attack_analysis::analyze(), wb::recall::apply_temp_modifier(), wb::recruit::apply_temp_modifier(), BOOST_AUTO_TEST_CASE(), ai::helper_place_unit(), game_lua_kernel::intf_put_unit(), actions::place_recruit(), wb::suppose_dead::remove_temp_modifier(), replace(), SYNCED_COMMAND_HANDLER_FUNCTION(), temporary_unit_mover::~temporary_unit_mover(), temporary_unit_placer::~temporary_unit_placer(), and temporary_unit_remover::~temporary_unit_remover().

bool unit_map::is_found ( const umap::const_iterator &  i) const
inlineprivate

Definition at line 542 of file map.hpp.

References umap_.

Referenced by is_valid(), make_const_unit_iterator(), and make_unit_iterator().

bool unit_map::is_found ( const lmap::const_iterator &  i) const
inlineprivate

Definition at line 547 of file map.hpp.

References lmap_.

bool unit_map::is_valid ( const umap::const_iterator &  i) const
inlineprivate

Definition at line 532 of file map.hpp.

References is_found().

Referenced by clear().

bool unit_map::is_valid ( const lmap::const_iterator &  i) const
inlineprivate

Definition at line 537 of file map.hpp.

References is_found().

template<typename X >
unit_map::const_unit_iterator unit_map::make_const_unit_iterator ( X const &  i) const
inlineprivate

Definition at line 563 of file map.hpp.

References is_found(), and umap_.

Referenced by begin(), and end().

template<typename X >
unit_map::unit_iterator unit_map::make_unit_iterator ( X const &  i)
inlineprivate

Definition at line 553 of file map.hpp.

References is_found(), and umap_.

Referenced by begin(), end(), insert(), and move().

unit_map::umap_retval_pair_t unit_map::move ( const map_location src,
const map_location dst 
)

Moves a unit from location src to location dst.

Returns
A pair consisting of an iterator pointing to the new unit (or the unit already occupying that location) and a bool indicating success.
Note
It is 3 times as fast to attempt to insert a unit at l and check for success than it is to verify that the location is empty, insert the unit, and then check the location for the unit.

Definition at line 94 of file map.cpp.

References DBG_NG, i, lmap_, make_unit_iterator(), p, and self_check().

Referenced by ai::attack_analysis::analyze(), game_lua_kernel::intf_teleport(), editor::editor_action_unit_replace::perform_without_undo(), lua_unit::put_map(), ai::simulated_move(), temporary_unit_mover::temporary_unit_mover(), actions::undo::move_action::undo(), and temporary_unit_mover::~temporary_unit_mover().

size_t unit_map::num_iters ( ) const

Add up number of extant iterators

Definition at line 233 of file map.cpp.

References umap_.

Referenced by clear(), and swap().

unit_map & unit_map::operator= ( const unit_map that)

Definition at line 46 of file map.cpp.

References swap().

unit_map::umap_retval_pair_t unit_map::replace ( const map_location l,
unit_ptr  p 
)

Works like unit_map::add; but l is emptied first, if needed.

Returns
A pair consisting of an iterator pointing to the new unit (or the unit already occupying that location) and a bool indicating success.

Definition at line 225 of file map.cpp.

References erase(), insert(), and self_check().

Referenced by unit_creator::add_unit(), ai::helper_advance_unit(), lua_unit::put_map(), and SYNCED_COMMAND_HANDLER_FUNCTION().

bool unit_map::self_check ( ) const

Checks invariants.

For debugging purposes only. Doesn't do anything in non-debug mode.

Definition at line 379 of file map.cpp.

References ERR_NG, lmap_, and umap_.

Referenced by add(), begin_core(), erase(), extract(), find(), insert(), move(), and replace().

size_t unit_map::size ( ) const
inline

Definition at line 425 of file map.hpp.

References lmap_.

Referenced by BOOST_AUTO_TEST_CASE(), and verify().

void unit_map::swap ( unit_map o)

Definition at line 53 of file map.cpp.

References lmap_, num_iters(), swap(), and umap_.

Referenced by operator=(), and swap().

Member Data Documentation

lmap unit_map::lmap_
private

location -> umap::iterator.

Definition at line 581 of file map.hpp.

Referenced by clear(), count(), empty(), extract(), find(), insert(), is_found(), move(), self_check(), size(), and swap().

umap unit_map::umap_
mutableprivate

underlying_id -> unit_pod.

This requires that underlying_id be unique (which is enforced in unit_map::insert).

Definition at line 576 of file map.hpp.

Referenced by begin_core(), clear(), end(), extract(), find(), has_unit(), insert(), is_found(), make_const_unit_iterator(), make_unit_iterator(), num_iters(), self_check(), and swap().


The documentation for this class was generated from the following files: