関数の中で一時関数を定義できればいいのにね。
例えばこんな感じ。

void function( int n ) {
 int inner_function( int n ) {
  return n * 2;
 }
 cout << inner_function( n );
}