Skip to content

Commit

Permalink
use std::bitset instead of vector<bool>
Browse files Browse the repository at this point in the history
for hotkey scope.
  • Loading branch information
gfgtdf committed Jun 21, 2014
1 parent 86f0f97 commit 7e3ba43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/hotkey/hotkey_command.cpp
Expand Up @@ -264,7 +264,7 @@ boost::ptr_vector<hotkey::hotkey_command> known_hotkeys;
std::map<std::string, size_t> command_map_;

//
std::vector<bool> scope_active_(hotkey::SCOPE_COUNT, false);
hotkey::hk_scopes scope_active_(0);

}

Expand All @@ -275,7 +275,7 @@ scope_changer::scope_changer()

scope_changer::~scope_changer()
{
scope_active_.swap(prev_scope_active_);
scope_active_ = prev_scope_active_;
}


Expand Down
5 changes: 4 additions & 1 deletion src/hotkey/hotkey_command.hpp
Expand Up @@ -19,6 +19,7 @@
#include "tstring.hpp"
#include "boost/ptr_container/ptr_vector.hpp"

#include <bitset>
class config;

namespace hotkey {
Expand Down Expand Up @@ -181,6 +182,8 @@ enum HOTKEY_COMMAND {
HOTKEY_NULL
};

typedef std::bitset<SCOPE_COUNT> hk_scopes;

/// Stores all information related to functions that can be bound to hotkeys.
/// this is currently a semi struct: it haves a constructor, but only const-public members.
struct hotkey_command {
Expand Down Expand Up @@ -234,7 +237,7 @@ class scope_changer {
scope_changer();
~scope_changer();
private:
std::vector<bool> prev_scope_active_;
hk_scopes prev_scope_active_;
};

/// returns a container that contains all currently active hotkey_commands.
Expand Down

0 comments on commit 7e3ba43

Please sign in to comment.