Skip to content

Commit

Permalink
fix vecvec::bucket::reference and add iterator types
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Aug 23, 2023
1 parent a6218e9 commit 706aeac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
33 changes: 16 additions & 17 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ AlwaysBreakTemplateDeclarations: true
SpacesBeforeTrailingComments: 2
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
---
BasedOnStyle: Google
ColumnLimit: 80
Expand All @@ -37,12 +37,11 @@ AlwaysBreakTemplateDeclarations: true
SpacesBeforeTrailingComments: 2
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
Priority: 3
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 3
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
4 changes: 3 additions & 1 deletion include/cista/containers/vecvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct basic_vecvec {
using iterator_category = std::random_access_iterator_tag;
using difference_type = std::ptrdiff_t;
using pointer = std::add_pointer_t<value_type>;
using reference = std::add_lvalue_reference<value_type>;
using reference = bucket;

bucket(basic_vecvec* map, index_value_type const i)
: map_{map}, i_{to_idx(i)} {}
Expand Down Expand Up @@ -262,6 +262,8 @@ struct basic_vecvec {
};

using value_type = bucket;
using iterator = bucket;
using const_iterator = const_bucket;

bucket operator[](Key const i) { return {this, to_idx(i)}; }
const_bucket operator[](Key const i) const { return {this, to_idx(i)}; }
Expand Down

0 comments on commit 706aeac

Please sign in to comment.