提交 5adb113b 编写于 作者: B Behdad Esfahbod

[meta] Mark function-objects as const

上级 ac90f17c
...@@ -35,7 +35,7 @@ template <typename T> ...@@ -35,7 +35,7 @@ template <typename T>
inline typename T::iter_t inline typename T::iter_t
hb_iter (const T& c) { return c.iter (); } hb_iter (const T& c) { return c.iter (); }
static HB_UNUSED struct hb_identity_t static HB_UNUSED const struct hb_identity_t
{ {
template <typename T> T template <typename T> T
operator () (const T& v) const { return v; } operator () (const T& v) const { return v; }
...@@ -59,13 +59,13 @@ struct hb_pair_t ...@@ -59,13 +59,13 @@ struct hb_pair_t
template <typename T1, typename T2> static inline hb_pair_t<T1, T2> template <typename T1, typename T2> static inline hb_pair_t<T1, T2>
hb_pair (T1 a, T2 b) { return hb_pair_t<T1, T2> (a, b); } hb_pair (T1 a, T2 b) { return hb_pair_t<T1, T2> (a, b); }
static HB_UNUSED struct hb_first_t static HB_UNUSED const struct hb_first_t
{ {
template <typename Pair> typename Pair::first_t template <typename Pair> typename Pair::first_t
operator () (const Pair& pair) const { return pair.first; } operator () (const Pair& pair) const { return pair.first; }
} hb_first; } hb_first;
static HB_UNUSED struct hb_second_t static HB_UNUSED const struct hb_second_t
{ {
template <typename Pair> typename Pair::second_t template <typename Pair> typename Pair::second_t
operator () (const Pair& pair) const { return pair.second; } operator () (const Pair& pair) const { return pair.second; }
......
...@@ -280,7 +280,7 @@ struct hb_filter_iter_factory_t ...@@ -280,7 +280,7 @@ struct hb_filter_iter_factory_t
Pred p; Pred p;
Proj f; Proj f;
}; };
template <typename Pred, typename Proj = hb_identity_t&> template <typename Pred, typename Proj = const hb_identity_t&>
inline hb_filter_iter_factory_t<Pred, Proj> inline hb_filter_iter_factory_t<Pred, Proj>
hb_filter (Pred&& p, Proj&& f = hb_identity) hb_filter (Pred&& p, Proj&& f = hb_identity)
{ return hb_filter_iter_factory_t<Pred, Proj> (p, f); } { return hb_filter_iter_factory_t<Pred, Proj> (p, f); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册