So explicit parametric polymorphism need not be restricted to a single type parameter. In other words I can write this in C++

template <typename First, typename Second>
struct Pair
{ First f;
Second s;
};

Can someone help me write a funciton "makePair" that takes two paramters of different types and returns a Pair containing its two values?
Hope someone can help

have a look at the standard header <utility>. it defines std::pair and std::make_pair.

template <typename First, typename Second>
struct Pair 
{  
  First f;
  Second s;
  Pair( const First& ff, const Second& ss ) :  f(ff), s(ss) {}
  // etc
};

template <typename First, typename Second> inline 
Pair<First,Second>   makePair( const First& f, const Second& s )
{ return   Pair<First,Second>( f, s ) ; }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.