All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
metric_traits.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2013 Piotr Wygocki
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #ifndef PAAL_METRIC_TRAITS_HPP
16 #define PAAL_METRIC_TRAITS_HPP
17 
19 
20 #include <type_traits>
21 
22 namespace paal {
23 namespace data_structures {
24 
31 template <typename Metric, typename _VertexType> struct _metric_traits {
32  using VertexType = _VertexType;
34  using DistanceType = puretype(std::declval<Metric>()(
35  std::declval<VertexType>(), std::declval<VertexType>()));
36 };
37 
43 template <typename Metric>
44 struct metric_traits : public _metric_traits<Metric, int> {};
45 }
46 }
47 #endif // PAAL_METRIC_TRAITS_HPP
#define puretype(t)
for given expression returns its type with removed const and reference
puretype(std::declval< Metric >()(std::declval< VertexType >(), std::declval< VertexType >())) DistanceType
Distance type.