[botan-devel] Fwd: Android compilation problem (std::pair<struct dirent*, std::string> Directory_Walker::get_next_dirent())

john skaller skaller at users.sourceforge.net
Fri Nov 7 12:03:47 EST 2014


On 08/11/2014, at 2:43 AM, Jack Lloyd wrote:

> On Wed, Nov 05, 2014 at 05:36:52PM +0400, Oleg Shalnev wrote:
> 
>> botan_all.cpp: In member function 'std::pair<dirent*,
>> std::basic_string<char> > Botan::(anonymous
>> namespace)::Directory_Walker::get_next_dirent()':
>> 
>> botan_all.cpp:21441:82: error: no matching function for call to
>> 'make_pair(dirent*&, std::basic_string<char>&)'
> 
> Is this error coming from the first or second call to make_pair?
> 
> That disabling C++11 mode in the file fixes it suggests maybe a bug in
> the 4.6 libstdc++ make_pair. Unfortunately I can't replicate this
> error on x86-64 with 4.5.4 or 4.7.3 (don't have a gcc 4.6 installed).


It's a bug in your code due to an incompatible change in make_pair.

In C++11 the arguments MUST be rvalues. The signature is:

template <class T1, class T2>
  pair<V1,V2> make_pair (T1&& x, T2&& y);  // see below for definition of V1 and V2

which will NOT bind to an lvalue.

In C++98 the signature was:

template <class T1, class T2>
  pair<T1,T2> make_pair (T1 x, T2 y);

which accepts either an lvalue or rvalue.

In C++14 the signature changes again to:

template< class T1, class T2 >
constexpr std::pair<V1,V2> make_pair( T1&& t, T2&& u );

I would suggest using the constructor

pair(a,b)

since that is provided with overload

pair(T1 const&, T2 const&)

which works for arguments of the right type whether rvalue or lvalue.


--
john skaller
skaller at users.sourceforge.net
http://felix-lang.org





More information about the botan-devel mailing list