File tree Expand file tree Collapse file tree 5 files changed +8
-12
lines changed
Expand file tree Collapse file tree 5 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ class Filter {
164164 * Memoized list of all field filters that can be found by
165165 * traversing the tree of filters contained in this composite filter.
166166 */
167- mutable util::ThreadSafeMemoizer<std::vector<FieldFilter>>
167+ mutable util::ThreadSafeMemoizer<const std::vector<FieldFilter>>
168168 memoized_flattened_filters_;
169169 };
170170
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ absl::optional<Operator> Query::FindOpInsideFilters(
9292 return absl::nullopt ;
9393}
9494
95- std::shared_ptr<std::vector<OrderBy>> Query::CalculateNormalizedOrderBys ()
95+ std::shared_ptr<const std::vector<OrderBy>> Query::CalculateNormalizedOrderBys ()
9696 const {
9797 // Any explicit order by fields should be added as is.
9898 auto result = std::make_shared<std::vector<OrderBy>>(explicit_order_bys_);
Original file line number Diff line number Diff line change @@ -299,14 +299,10 @@ class Query {
299299
300300 Target ToTarget (const std::vector<OrderBy>& order_bys) const ;
301301
302- // For properties below, use a `std::shared_ptr<ThreadSafeMemoizer>` rather
303- // than using `ThreadSafeMemoizer` directly so that this class is copyable
304- // (`ThreadSafeMemoizer` is not copyable because of its `std::once_flag`
305- // member variable, which is not copyable).
306-
307302 // The memoized list of sort orders.
308- std::shared_ptr<std::vector<OrderBy>> CalculateNormalizedOrderBys () const ;
309- mutable util::ThreadSafeMemoizer<std::vector<OrderBy>>
303+ std::shared_ptr<const std::vector<OrderBy>> CalculateNormalizedOrderBys ()
304+ const ;
305+ mutable util::ThreadSafeMemoizer<const std::vector<OrderBy>>
310306 memoized_normalized_order_bys_;
311307
312308 // The corresponding Target of this Query instance.
Original file line number Diff line number Diff line change @@ -81,15 +81,15 @@ CountingFunc::CountingFunc(std::vector<std::string> chunks)
8181std::function<std::shared_ptr<std::string>()> CountingFunc::func (
8282 std::string cookie) {
8383 return [this , cookie = std::move (cookie)] {
84- return std::make_shared<std::string>(Next (cookie));
84+ return std::make_shared<std::string>(NextFuncReturnValue (cookie));
8585 };
8686}
8787
8888int CountingFunc::invocation_count () const {
8989 return count_.load (std::memory_order_acquire);
9090}
9191
92- std::string CountingFunc::Next (const std::string& cookie) {
92+ std::string CountingFunc::NextFuncReturnValue (const std::string& cookie) {
9393 const int id = count_.fetch_add (1 , std::memory_order_acq_rel);
9494 std::ostringstream ss;
9595 for (const std::string& chunk : chunks_) {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ class CountingFunc {
9797 std::vector<std::string> chunks_;
9898
9999 explicit CountingFunc (std::vector<std::string> chunks);
100- std::string Next (const std::string& cookie);
100+ std::string NextFuncReturnValue (const std::string& cookie);
101101};
102102
103103/* *
You can’t perform that action at this time.
0 commit comments