mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Remove inclusion of algorithm almost everywhere
This commit is contained in:
@@ -410,7 +410,7 @@ public:
|
||||
* \return The stored options.
|
||||
*/
|
||||
const options_type& options() const {
|
||||
return ip_options_;
|
||||
return options_;
|
||||
}
|
||||
|
||||
/* Setters */
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
*/
|
||||
void add_option(option &&opt) {
|
||||
internal_add_option(opt);
|
||||
ip_options_.push_back(std::move(opt));
|
||||
options_.push_back(std::move(opt));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -538,8 +538,8 @@ public:
|
||||
*/
|
||||
template<typename... Args>
|
||||
void add_option(Args&&... args) {
|
||||
ip_options_.emplace_back(std::forward<Args>(args)...);
|
||||
internal_add_option(ip_options_.back());
|
||||
options_.emplace_back(std::forward<Args>(args)...);
|
||||
internal_add_option(options_.back());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -770,7 +770,7 @@ private:
|
||||
|
||||
ip_header header_;
|
||||
uint16_t options_size_, padded_options_size_;
|
||||
options_type ip_options_;
|
||||
options_type options_;
|
||||
};
|
||||
|
||||
} // Tins
|
||||
|
||||
@@ -537,22 +537,36 @@ private:
|
||||
};
|
||||
|
||||
namespace Internals {
|
||||
/*
|
||||
* \cond
|
||||
*/
|
||||
template <typename Option>
|
||||
struct option_type_equality_comparator {
|
||||
option_type_equality_comparator(typename Option::option_type type) : type(type) { }
|
||||
/*
|
||||
* \cond
|
||||
*/
|
||||
|
||||
bool operator()(const Option& opt) const {
|
||||
return opt.option() == type;
|
||||
template <typename Option, typename Container>
|
||||
typename Container::iterator find_option(Container& cont, typename Option::option_type type) {
|
||||
typename Container::iterator iter;
|
||||
for (iter = cont.begin(); iter != cont.end(); ++iter) {
|
||||
if (iter->option() == type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
typename Option::option_type type;
|
||||
};
|
||||
/*
|
||||
* \endcond
|
||||
*/
|
||||
template <typename Option, typename Container>
|
||||
typename Container::const_iterator find_option_const(const Container& cont,
|
||||
typename Option::option_type type) {
|
||||
typename Container::const_iterator iter;
|
||||
for (iter = cont.begin(); iter != cont.end(); ++iter) {
|
||||
if (iter->option() == type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
/*
|
||||
* \endcond
|
||||
*/
|
||||
} // Internals
|
||||
|
||||
} // namespace Tins
|
||||
|
||||
Reference in New Issue
Block a user