Home | History | Annotate | Download | only in depr.function.pointer.adaptors
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <functional>
     11 
     12 // pointer_to_unary_function
     13 
     14 #include <functional>
     15 #include <type_traits>
     16 #include <cassert>
     17 
     18 double unary_f(int i) {return 0.5 - i;}
     19 
     20 int main()
     21 {
     22     typedef std::pointer_to_unary_function<int, double> F;
     23     static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
     24     const F f(unary_f);
     25     assert(f(36) == -35.5);
     26 }
     27