Skip to content

Commit

Permalink
Cleaned up equal_range: it *must* use boost::tuple, not std::tuple, i…
Browse files Browse the repository at this point in the history
…n order to look up by multiple fields of a composite key, but that works.
  • Loading branch information
wrwilliams committed Dec 5, 2016
1 parent 2ce139a commit 1182446
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions symtabAPI/src/LineInformation.C
Expand Up @@ -212,29 +212,17 @@ std::pair<LineInformation::const_line_info_iterator, LineInformation::const_line
LineInformation::equal_range(std::string file, const unsigned int lineNo) const {
auto found = strings_->get<1>().find(file);
unsigned index = strings_->project<0>(found) - strings_->begin();
// auto search_info = std::make_tuple(index, lineNo);
std::pair<LineInformation::const_line_info_iterator, LineInformation::const_line_info_iterator > bounds;
bounds = get<Statement::line_info>().equal_range(index);
while((*bounds.first)->getLine() < lineNo && bounds.first != bounds.second) {
++bounds.first;
}
while((*bounds.second)->getLine() > lineNo && bounds.second != bounds.first) {
--bounds.second;
}
if(bounds.second != get<Statement::line_info>().end()) ++bounds.second;
auto idx = boost::make_tuple(index, lineNo);
bounds = get<Statement::line_info>().equal_range(idx);
return bounds;
// return get<traits::line_info>().equal_range(boost::cref<std::tuple<unsigned int, unsigned int> >(search_info));

}

std::pair<LineInformation::const_line_info_iterator, LineInformation::const_line_info_iterator>
LineInformation::equal_range(std::string file) const {
auto found = strings_->get<1>().find(file);
unsigned index = strings_->project<0>(found) - strings_->begin();
return get<Statement::line_info>().equal_range(index);
// const traits::line_info_index& by_line_info = impl_t::get<traits::line_info>();
// return by_line_info.equal_range(file);

}

StringTablePtr LineInformation::getStrings() {
Expand Down

0 comments on commit 1182446

Please sign in to comment.