fork(1) download
  1. #include <iostream>
  2. #include <typeinfo>
  3. #include <utility>
  4.  
  5. template< typename ... Args >
  6. auto MyMakePair( Args&&... args ) -> decltype( std::make_pair( std::forward<Args>(args)... ) )
  7. {
  8. return std::make_pair( std::forward<Args>(args)... );
  9. }
  10.  
  11. int main()
  12. {
  13. auto pair = MyMakePair( 27ul, 4.2f );
  14.  
  15. std::cout << "first: " << typeid(pair.first).name() << " " << pair.first << '\n';
  16. std::cout << "second: " << typeid(pair.second).name() << " " << pair.second << '\n';
  17. }
  18.  
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
first: m 27
second: f 4.2