2121
2222#include < istream>
2323#include < memory>
24+ #include < unordered_set>
2425#include < vector>
2526#include < bitcoin/system/data/data.hpp>
2627#include < bitcoin/system/define.hpp>
@@ -112,6 +113,13 @@ bool operator<(const point& left, const point& right) NOEXCEPT;
112113
113114typedef std_vector<point> points;
114115
116+ // / Constant reference optimizers.
117+ using point_cref = std::reference_wrapper<const point>;
118+ using unordered_set_of_point_cref = std::unordered_set<point_cref>;
119+ BC_API bool operator <(const point_cref& left, const point_cref& right) NOEXCEPT;
120+ BC_API bool operator ==(const point_cref& left, const point_cref& right) NOEXCEPT;
121+ BC_API bool operator !=(const point_cref& left, const point_cref& right) NOEXCEPT;
122+
115123DECLARE_JSON_VALUE_CONVERTORS (point);
116124DECLARE_JSON_VALUE_CONVERTORS (point::cptr);
117125
@@ -127,27 +135,19 @@ struct hash<bc::system::chain::point>
127135 size_t operator ()(const bc::system::chain::point& value) const NOEXCEPT
128136 {
129137 return bc::system::hash_combine (value.index (),
130- bc::system::unique_hash_t <>{} (value.hash ()));
138+ bc::system::unique_hash (value.hash ()));
131139 }
132140};
133141
134142template <>
135- struct hash <std::reference_wrapper< const bc::system::chain::point> >
143+ struct hash <bc::system::chain::point_cref >
136144{
137- using wrapped = std::reference_wrapper< const bc::system::chain::point>;
138- std:: size_t operator ()( const wrapped& point ) const NOEXCEPT
145+ std::size_t operator ()(
146+ const bc::system::chain::point_cref& value ) const NOEXCEPT
139147 {
140- return std::hash<bc::system::chain::point>{}(point .get ());
148+ return std::hash<bc::system::chain::point>{}(value .get ());
141149 }
142150};
143-
144- inline bool operator ==(
145- const std::reference_wrapper<const bc::system::chain::point>& left,
146- const std::reference_wrapper<const bc::system::chain::point>& right) NOEXCEPT
147- {
148- return left.get () == right.get ();
149- }
150-
151151} // namespace std
152152
153153#endif
0 commit comments