]> git.sesse.net Git - stockfish/commit
Fix compilation with Android NDK
authorMarco Costalba <mcostalba@gmail.com>
Wed, 9 May 2012 07:33:25 +0000 (09:33 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 11 May 2012 16:16:51 +0000 (17:16 +0100)
commitcaef31921900e092616c56193e37201b08baa875
treeac14aa0af083ea9bedaf26442053239c9639cdfb
parent2f47844c7cb34c7de5b5d41cda10b7d8736a20bc
Fix compilation with Android NDK

It seems ADL lookup is broken with the STLPort library. Peter says:

The compiler is gcc 4.4.3, but I don't know how many patches they
have applied to it. I think gcc has had support for Koenig lookup
a long time. I think the problem is the type of the vector iterator.
For example, line 272 in search.cpp:

 if (bookMove && count(RootMoves.begin(), RootMoves.end(), bookMove))

gives the error:

jni/stockfish/search.cpp:272: error: 'count' was not declared in this scope

Here RootMoves is:

 std::vector<RootMove> RootMoves;

If std::vector<T>::iterator is implemented as T*, then Koenig lookup
would fail because RootMove* is not in namespace std.

I compile with the stlport implementation of STL, which in its vector
class has:

 typedef value_type* iterator;

I'm not sure if this is allowed by the C++ standard. I did not find
anything that says the iterator type must belong to namespace std.
The consensus in this thread

http://compgroups.net/comp.lang.c++.moderated/argument-dependent-lookup/433395

is that the stlport iterator type is allowed.

Report and patch by Peter Osterlund.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/endgame.cpp
src/search.cpp
src/types.h
src/ucioption.cpp