51 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS10 11// <functional>12 13// not_equal_to14 15#include <functional>16#include <type_traits>17#include <cassert>18 19#include "test_macros.h"20 21int main(int, char**)22{23 typedef std::not_equal_to<int> F;24 const F f = F();25#if TEST_STD_VER <= 1726 static_assert((std::is_same<int, F::first_argument_type>::value), "" );27 static_assert((std::is_same<int, F::second_argument_type>::value), "" );28 static_assert((std::is_same<bool, F::result_type>::value), "" );29#endif30 assert(!f(36, 36));31 assert(f(36, 6));32#if TEST_STD_VER > 1133 typedef std::not_equal_to<> F2;34 const F2 f2 = F2();35 assert(!f2(36, 36));36 assert( f2(36, 6));37 assert( f2(36, 6.0));38 assert( f2(36.0, 6));39 assert(!f2(36.0, 36));40 assert(!f2(36, 36.0));41 42 constexpr bool foo = std::not_equal_to<int> () (36, 36);43 static_assert ( !foo, "" );44 45 constexpr bool bar = std::not_equal_to<> () (36.0, 36);46 static_assert ( !bar, "" );47#endif48 49 return 0;50}51