mlpack
boost_backport_string_view.hpp
Go to the documentation of this file.
1 
15 #ifndef MLPACK_CORE_BOOST_BACKPORT_STRING_VIEW_HPP
16 #define MLPACK_CORE_BOOST_BACKPORT_STRING_VIEW_HPP
17 
18 #include <boost/version.hpp>
19 #include <boost/functional/hash.hpp>
20 
21 #if BOOST_VERSION < 106100
22  // Backported unordered_map.
23  #include "mlpack/core/boost_backport/string_view.hpp"
24 #else
25  // Boost's version.
26  #include <boost/utility/string_view.hpp>
27 #endif
28 
29 #if BOOST_VERSION < 106900
30  namespace boost
31  {
32  template<>
33  struct hash<boost::string_view>
34  {
35  std::size_t operator()(boost::string_view str) const
36  {
37  return boost::hash_range(str.begin(), str.end());
38  }
39  };
40  }
41 #endif
42 
43 #endif // MLPACK_CORE_BOOST_BACKPORT_STRING_VIEW_HPP
Definition: bernoulli.hpp:17
Definition: string_view.hpp:60