#include <iostream>
#include <string>
#include <type_traits>
void function ( int v = 0 ) ; // declaration (header)
// definition of void function ( int )
void function( const int v ) { std::cout << v << '
' ; /* definition */ }
// *** error: redefinition of void function ( int )
// void function( int v ) { std::cout << v << '
' ; /* definition */ }
// declaration and definition
void function_two( const int v ) { std::cout << v << '
' ; /* definition */ }
int main()
{
function(7) ;
using function_type = void( int ) ;
function_type* fn = function ; // fine
fn = function_two ; // also fine note: const is ignored
using function_type_const = void( const int ) ; // note: const is ignored
function_type_const* fnconst = function ; // fine
fnconst = function_two ; // also fine
std::cout << std::boolalpha << "void(int) and void( const int ) are the same type: "
<< std::is_same< void(int), void( const int ) >::value << '
' ; // true
}