mirror of
https://github.com/boostorg/hana.git
synced 2026-02-01 20:42:13 +00:00
35 lines
982 B
C++
35 lines
982 B
C++
/*
|
|
@copyright Louis Dionne 2015
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
|
|
#include <boost/hana/core/common.hpp>
|
|
|
|
#include <type_traits>
|
|
using namespace boost::hana;
|
|
|
|
|
|
template <typename T>
|
|
struct ImplicitConvertibleTo {
|
|
constexpr operator T() const { return {}; }
|
|
};
|
|
|
|
struct T { };
|
|
struct invalid;
|
|
|
|
static_assert(std::is_same<common_t<T, T>, T>{}, "");
|
|
static_assert(std::is_same<common_t<invalid, invalid>, invalid>{}, "");
|
|
static_assert(std::is_same<common_t<void, void>, void>{}, "");
|
|
|
|
static_assert(std::is_same<common_t<ImplicitConvertibleTo<T>, T>, T>{}, "");
|
|
static_assert(std::is_same<common_t<T, ImplicitConvertibleTo<T>>, T>{}, "");
|
|
|
|
static_assert(has_common<T, T>{}, "");
|
|
static_assert(!has_common<void, T>{}, "");
|
|
static_assert(!has_common<T, void>{}, "");
|
|
static_assert(!has_common<invalid, T>{}, "");
|
|
static_assert(!has_common<T, invalid>{}, "");
|
|
|
|
int main() { }
|