openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
type_traits.hpp
Go to the documentation of this file.
1// Copyright 2023 Jij Inc.
2
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6
7// http://www.apache.org/licenses/LICENSE-2.0
8
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <cstddef>
18#include <type_traits>
19
20namespace openjij {
21namespace utility {
22
27template <template <typename...> class, template <typename...> class>
28struct is_same_template : std::false_type {};
29
34template <template <typename...> class T>
35struct is_same_template<T, T> : std::true_type {};
36
46template <typename derived_class, typename head_base_class,
47 typename... tail_base_classes>
49 using type = typename std::conditional<
50 std::is_base_of<head_base_class, derived_class>::value, head_base_class,
51 typename get_base_class<derived_class, tail_base_classes...>::type>::type;
52};
53
63template <typename derived_class, typename base_class>
64struct get_base_class<derived_class, base_class> {
65 using type = typename std::conditional<
66 std::is_base_of<base_class, derived_class>::value, base_class,
67 std::nullptr_t>::type;
68};
69
70} // namespace utility
71} // namespace openjij
Definition algorithm.hpp:24
typename std::conditional< std::is_base_of< base_class, derived_class >::value, base_class, std::nullptr_t >::type type
Definition type_traits.hpp:67
meta function for linear-searching base class of "derived_class" from the variadic template list (hea...
Definition type_traits.hpp:48
typename std::conditional< std::is_base_of< head_base_class, derived_class >::value, head_base_class, typename get_base_class< derived_class, tail_base_classes... >::type >::type type
Definition type_traits.hpp:51
check if two template template parameters are the same.
Definition type_traits.hpp:28