1//
2// Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7
8#include <boost/mysql/detail/typing/get_type_index.hpp>
9
10#include <tuple>
11
12using boost::mysql::detail::get_type_index;
13using boost::mysql::detail::index_not_found;
14
15namespace {
16
17using r1 = std::tuple<int>;
18using r2 = std::tuple<float>;
19using r3 = std::tuple<double>;
20
21static_assert(get_type_index<r1, r1, r2, r3>() == 0u, "");
22static_assert(get_type_index<r2, r1, r2, r3>() == 1u, "");
23static_assert(get_type_index<r3, r1, r2, r3>() == 2u, "");
24
25static_assert(get_type_index<r1, r1, r1, r1>() == 0u, "");
26
27static_assert(get_type_index<r1, r1, r2, r1, r3, r1, r2, r3, r1>() == 0u, "");
28static_assert(get_type_index<r2, r1, r2, r1, r3, r1, r2, r3, r1>() == 1u, "");
29static_assert(get_type_index<r3, r1, r2, r1, r3, r1, r2, r3, r1>() == 2u, "");
30
31static_assert(get_type_index<r1, r1>() == 0u, "");
32
33static_assert(get_type_index<r1>() == index_not_found, "");
34static_assert(get_type_index<r1, r2>() == index_not_found, "");
35static_assert(get_type_index<r1, r2, r2, r3, r2>() == index_not_found, "");
36
37} // namespace
38

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of boost/libs/mysql/test/unit/test/detail/typing/get_type_index.cpp