Skip to content


Subversion checkout URL

You can clone with
Download ZIP


extconf.rb test for HAVE_MAKE_PAIR improvement #416

nrowe opened this Issue · 2 comments

2 participants


Propose changing the line:

pair<int,int> tuple = make_pair(1,2);


pair<const int,int> tuple = make_pair(1,2);

This will fix compiling on Solaris with newer sun studio compilers.

The following test:

# solaris c++ compiler doesn't have make_pair()
TRY_LINK.sub!('$(CC)', '$(CXX)')
add_define 'HAVE_MAKE_PAIR' if try_link(<<SRC, '-lstdc++')
  #include <utility>
  using namespace std;
  int main(){ pair<int,int> tuple = make_pair(1,2); }
TRY_LINK.sub!('$(CXX)', '$(CC)')

only checks for the presence of make_pair function on Solaris. Newer sun studio compilers do support make_pair but do not provide the const copy constructor, ie:

template<typename T1, typename T2>
pair::pair(const pair<const T1, T2>& rhs) ...

The signature for a multimap insert is:

iterator insert(const value_type& x);

where value_type "is required to be pair"

The std::make_pair calls for multimap::insert will create the following compiler error on sun studio compilers without the STLPORT library specified:

"em.cpp", line 409: Error: Could not find a match for 
std::multimap<unsigned long long, EventableDescriptor*, std::less<unsigned long long>,
  std::allocator<std::pair<const unsigned long long, EventableDescriptor*>>>::insert(
     std::pair<unsigned long long, EventableDescriptor*>) needed in

The non HAVE_MAKE_PAIR code will work just fine. Changing the check for make_pair to also test for type conversion will work on all "compliant" standard libraries, including sun studio with "library=stlport4".


Propose changing the line:

pair tuple = make_pair(1,2);
pair tuple = make_pair(1,2);

These are identical.


Oops, the template parameters were stripped out as html tags.

@tmm1 tmm1 closed this in f254e79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.