Skip to content

Commit

Permalink
Add sorted_vector_set::const_pointer (#1987)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1987

similarly, `std::set` has const_pointer

Reviewed By: swolchok

Differential Revision: D45194122

fbshipit-source-id: 5ad1b7c40fb21a92333603d804ee2e3f16c78f27
  • Loading branch information
Fan Wang authored and facebook-github-bot committed Apr 22, 2023
1 parent fc8514e commit e3b9b1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions folly/sorted_vector_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class sorted_vector_set : detail::growth_policy_wrapper<GrowthPolicy> {
typedef typename Container::pointer pointer;
typedef typename Container::reference reference;
typedef typename Container::const_reference const_reference;
typedef typename Container::const_pointer const_pointer;
/*
* XXX: Our normal iterator ought to also be a constant iterator
* (cf. Defect Report 103 for std::set), but this is a bit more of a
Expand Down
3 changes: 3 additions & 0 deletions folly/test/sorted_vector_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ static_assert(!folly::is_sorted_vector_set_v<std::set<int>>);
static_assert(!folly::is_sorted_vector_set_v<std::unordered_set<int>>);
static_assert(!folly::is_sorted_vector_set_v<std::vector<int>>);

static_assert(
std::is_same_v<folly::sorted_vector_set<int>::const_pointer, const int*>);

static_assert(std::is_same_v<
folly::sorted_vector_map<int, double>::pointer,
std::pair<int, double>*>);
Expand Down

0 comments on commit e3b9b1e

Please sign in to comment.