Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Overload resolve function pointer
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//g++ 4.9.3 #include <iostream> #ifndef KS_CONSTEXPR # if defined(__GNUC__) || _MSC_VER >= 1900 # define KS_CONSTEXPR_IMPLED # define KS_CONSTEXPR constexpr # define KS_CONST constexpr # else # define KS_CONSTEXPR # define KS_CONST const # endif #endif template <typename... Args> struct SNonConstOverload { template <typename R, typename T> KS_CONSTEXPR auto operator() (R(T::*ptr)(Args...)) const { return ptr; } }; template <typename... Args> struct SConstOverload { template <typename R, typename T> KS_CONSTEXPR auto operator() (R(T::*ptr)(Args...) const) const { return ptr; } }; template <typename... Args> struct SOverload : SConstOverload<Args...>, SNonConstOverload < Args... > { using SConstOverload<Args...>::operator(); using SNonConstOverload<Args...>::operator(); template <typename R> KS_CONSTEXPR auto operator() (R(*ptr)(Args...)) const { return ptr; } }; struct CS { double cos(double d){ return 0.0;} double cos(int, int){return 0.0;} }; int main() { auto x = SOverload<double>{}(&CS::cos); auto y = SOverload<int, int>{}(&CS::cos); std::cout << "Hello, world!\n"; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,57 sec, absolute running time: 0,24 sec, absolute service time: 1,82 sec
fork mode
|
history
|
discussion
Hello, world!