Skip to content

Commit 5338000

Browse files
committed
Make iterators const if possible
1 parent cc1719d commit 5338000

39 files changed

+195
-195
lines changed

hazelcast/include/hazelcast/client/iexecutor_service.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ class HAZELCAST_API iexecutor_service : public proxy::ProxyImpl
208208
void execute_on_members(const HazelcastSerializable& command,
209209
const std::vector<member>& members)
210210
{
211-
for (std::vector<member>::const_iterator it = members.begin();
212-
it != members.end();
211+
for (std::vector<member>::const_iterator it = members.cbegin();
212+
it != members.cend();
213213
++it) {
214214
submit_to_member<HazelcastSerializable, executor_marker>(command,
215215
*it);
@@ -241,8 +241,8 @@ class HAZELCAST_API iexecutor_service : public proxy::ProxyImpl
241241
{
242242
std::vector<member> memberList =
243243
get_context().get_client_cluster_service().get_member_list();
244-
for (std::vector<member>::const_iterator it = memberList.begin();
245-
it != memberList.end();
244+
for (std::vector<member>::const_iterator it = memberList.cbegin();
245+
it != memberList.cend();
246246
++it) {
247247
submit_to_member<HazelcastSerializable, executor_marker>(command,
248248
*it);

hazelcast/include/hazelcast/client/imap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ class HAZELCAST_API imap : public proxy::IMapImpl
10631063
resultFutures.push_back(
10641064
put_all_internal(partitionId, std::move(partitionEntry.second)));
10651065
}
1066-
return boost::when_all(resultFutures.begin(), resultFutures.end())
1066+
return boost::when_all(resultFutures.cbegin(), resultFutures.cend())
10671067
.then(boost::launch::sync,
10681068
[](boost::future<boost::csbl::vector<
10691069
boost::future<protocol::ClientMessage>>> futures) {
@@ -1308,8 +1308,8 @@ class HAZELCAST_API imap : public proxy::IMapImpl
13081308
query::iteration_type iteration_type,
13091309
std::vector<std::pair<K, boost::optional<V>>> entries)
13101310
{
1311-
std::sort(entries.begin(),
1312-
entries.end(),
1311+
std::sort(entries.cbegin(),
1312+
entries.cend(),
13131313
[&](const std::pair<K, boost::optional<V>>& lhs,
13141314
const std::pair<K, boost::optional<V>>& rhs) {
13151315
auto comparator = predicate.getComparator();

hazelcast/include/hazelcast/client/internal/config/ConfigUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ConfigUtils
3737
const std::string& item_name)
3838
{
3939
auto candidate = config_patterns.find(item_name);
40-
if (candidate != config_patterns.end()) {
40+
if (candidate != config_patterns.cend()) {
4141
return &candidate->second;
4242
}
4343
auto size = config_patterns.size();
@@ -50,7 +50,7 @@ class ConfigUtils
5050
config_pattern_matcher.matches(keys, item_name);
5151
if (configPatternKey) {
5252
candidate = config_patterns.find(*configPatternKey);
53-
if (candidate != config_patterns.end()) {
53+
if (candidate != config_patterns.cend()) {
5454
return &candidate->second;
5555
}
5656
}

hazelcast/include/hazelcast/client/internal/nearcache/impl/store/BaseHeapNearCacheRecordStore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class BaseHeapNearCacheRecordStore
7777
entries = ANCRS::records_->entry_set();
7878
for (typename std::vector<std::pair<std::shared_ptr<KS>,
7979
std::shared_ptr<R>>>::const_iterator
80-
it = entries.begin();
81-
it != entries.end();
80+
it = entries.cbegin();
81+
it != entries.cend();
8282
++it) {
8383
const std::pair<std::shared_ptr<KS>, std::shared_ptr<R>>& entry =
8484
(*it);

hazelcast/include/hazelcast/client/internal/nearcache/impl/store/HeapNearCacheRecordMap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class HeapNearCacheRecordMap
127127
}
128128
int actualEvictedCount = 0;
129129
for (typename std::vector<std::shared_ptr<C>>::const_iterator it =
130-
eviction_candidates->begin();
131-
it != eviction_candidates->end();
130+
eviction_candidates->cbegin();
131+
it != eviction_candidates->cend();
132132
++it) {
133133
const std::shared_ptr<C>& evictionCandidate = *it;
134134
if (util::SynchronizedMap<std::shared_ptr<KS>, R>::remove(

hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class NearCachedClientMapProxy
404404
std::move(entry.second));
405405
bool marked = false;
406406
auto foundEntry = markers->find(key);
407-
if (foundEntry != markers->end()) {
407+
if (foundEntry != markers->cend()) {
408408
marked = foundEntry->second;
409409
markers->erase(foundEntry);
410410
}
@@ -601,8 +601,8 @@ class NearCachedClientMapProxy
601601

602602
void unmark_remaining_marked_keys(MARKER_MAP& markers)
603603
{
604-
for (MARKER_MAP::const_iterator it = markers.begin();
605-
it != markers.end();
604+
for (MARKER_MAP::const_iterator it = markers.cbegin();
605+
it != markers.cend();
606606
++it) {
607607
if (it->second) {
608608
key_state_marker_->force_unmark(*it->first);

hazelcast/include/hazelcast/client/pipelining.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class pipelining : public std::enable_shared_from_this<pipelining<E>>
117117
{
118118
std::vector<boost::optional<E>> result;
119119
result.reserve(futures_.size());
120-
auto result_futures = when_all(futures_.begin(), futures_.end());
120+
auto result_futures = when_all(futures_.cbegin(), futures_.cend());
121121
for (auto& f : result_futures.get()) {
122122
result.emplace_back(f.get());
123123
}
@@ -163,8 +163,8 @@ class pipelining : public std::enable_shared_from_this<pipelining<E>>
163163
}
164164

165165
if (!outStandingFutures.empty()) {
166-
boost::when_any(outStandingFutures.begin(),
167-
outStandingFutures.end())
166+
boost::when_any(outStandingFutures.cbegin(),
167+
outStandingFutures.cend())
168168
.get();
169169
}
170170
}

hazelcast/include/hazelcast/client/protocol/ClientMessageBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ClientMessageBuilder
103103
bool result = false;
104104

105105
auto found = partial_messages_.find(fragmentation_id);
106-
if (partial_messages_.end() != found) {
106+
if (partial_messages_.cend() != found) {
107107
found->second->append(std::move(msg));
108108
if (is_end_fragment) {
109109
// remove from message from map

hazelcast/include/hazelcast/client/proxy/SerializingProxy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class HAZELCAST_API SerializingProxy
9797
inline boost::future<std::unordered_map<K, V>> to_object_map(
9898
std::vector<boost::future<EntryVector>>& futures)
9999
{
100-
return boost::when_all(futures.begin(), futures.end())
100+
return boost::when_all(futures.cbegin(), futures.cend())
101101
.then(boost::launch::sync,
102102
[this](
103103
boost::future<boost::csbl::vector<boost::future<EntryVector>>>

hazelcast/include/hazelcast/client/serialization/pimpl/data_output.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ const std::vector<byte>& data_output::to_byte_array() const
216216

217217
void data_output::append_bytes(const std::vector<byte>& bytes)
218218
{
219-
output_stream_.insert(output_stream_.end(), bytes.begin(), bytes.end());
219+
output_stream_.insert(output_stream_.cend(), bytes.cbegin(), bytes.cend());
220220
}
221221

222222
void data_output::write_zero_bytes(size_t number_of_bytes)
223223
{
224-
output_stream_.insert(output_stream_.end(), number_of_bytes, 0);
224+
output_stream_.insert(output_stream_.cend(), number_of_bytes, 0);
225225
}
226226

227227
size_t data_output::position() const

0 commit comments

Comments
 (0)