Skip to content

Commit 09ac6f0

Browse files
committed
Make method provider_options::for_each() const
Also, add a comment for the method and fix formatting
1 parent 41437e0 commit 09ac6f0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

include/wsrep/provider_options.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ namespace wsrep
253253
std::unique_ptr<option_value> value,
254254
std::unique_ptr<option_value> default_value, int flags);
255255

256-
void for_each(const std::function<void(option*)>& fn);
256+
/**
257+
* Invoke the given function with each provider option
258+
* as argument.
259+
*
260+
* @param fn Function to call for each option
261+
*/
262+
void for_each(const std::function<void(option*)>& fn) const;
257263

258264
private:
259265
using options_map = std::map<std::string, std::unique_ptr<option>>;

src/provider_options.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ enum wsrep::provider::status wsrep::provider_options::set_default(
161161
return wsrep::provider::success;
162162
}
163163

164-
void wsrep::provider_options::for_each(const std::function<void(option*)>& fn)
164+
void wsrep::provider_options::for_each(
165+
const std::function<void(option*)>& fn) const
165166
{
166-
std::for_each(
167-
options_.begin(), options_.end(),
168-
[&fn](const options_map::value_type& opt) { fn(opt.second.get()); });
167+
std::for_each(options_.begin(), options_.end(),
168+
[&fn](const options_map::value_type& opt)
169+
{ fn(opt.second.get()); });
169170
}

0 commit comments

Comments
 (0)