forked from grantrostig/file_maintenance_clipped
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfield_navigation_interaction_map.cpp
More file actions
20 lines (17 loc) · 1.08 KB
/
field_navigation_interaction_map.cpp
File metadata and controls
20 lines (17 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "field_navigation_interaction_map.h"
#include <cassert>
#include <tuple>
#include <set>
bool FieldNavInteractionIntentTable::verify() const {
size_t radix = static_cast<int>(Lib_tty::InteractionIntentNav::na) + 2; // accounts for duplicate int
assert( rows.size() % radix == 0 ); // accounts for duplicate int
assert( rows.size() % (static_cast<int>( InteractionCategory::na )) == 0 );
struct Compare {
bool operator() (FieldNavInteractionIntentRow const & lhs, FieldNavInteractionIntentRow const & rhs ) const {
return std::tie( lhs.category, lhs.field_nav ) < std::tie( rhs.category, rhs.field_nav ); // https://foonathan.net/2018/07/ordering-relations-programming/
}
};
std::set< FieldNavInteractionIntentRow, Compare > temp { rows.begin(), rows.end() }; // TODO: TODO: how do I capture radix, when this thing only takes a type?
assert( rows.size() == temp.size() + static_cast<int>( InteractionCategory::na )); // checks for duplicate int suppressed by std::set
return true;
}