summaryrefslogtreecommitdiff
path: root/deps/tao_tuple/28626e99/include/tao/seq/max.hpp
blob: b3f5be79767408acbd3b6337df611ff80326e4c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// The Art of C++ / Sequences
// Copyright (c) 2015 Daniel Frey

#ifndef TAOCPP_SEQUENCES_INCLUDE_MAX_HPP
#define TAOCPP_SEQUENCES_INCLUDE_MAX_HPP

#include "fold.hpp"

#include <type_traits>

namespace tao
{
  namespace seq
  {
    namespace impl
    {
      template< typename T, T A, T B >
      using max = std::integral_constant< T, ( ( A > B ) ? A : B ) >;
    }

    template< typename T, T... Ns >
    struct max
      : fold< impl::max, T, Ns... >
    {};

    template< typename T, T... Ns >
    struct max< integer_sequence< T, Ns... > >
      : max< T, Ns... >
    {};
  }
}

#endif // TAOCPP_SEQUENCES_INCLUDE_MAX_HPP