tremlin / PermLib

a C++ library implementing permutation group algorithms
Other
13 stars 2 forks source link

Compilation error #2

Closed DavidDeharbe closed 10 years ago

DavidDeharbe commented 10 years ago

Hello,

I have recently "upgraded" my OS (OS X 10.9) and the constructor development tools (XCode 5.0.2). This is probably why I can no longer compile permlib. The compiler cannot resolve calls to copy_if. The two candidates are permlib's own version and the the standard library algorithm's version.

Details follow...

I hope that helps.

Best regards,

-- David Deharbe.

g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix

In file included from ../permlib-0.2.8/include/permlib/permlib_api.h:46: ../permlib-0.2.8/include/permlib/search/orbit_lex_min_search.h:178:2: error: call to 'copy_if' is ambiguous std::copy_if(m_bsgs.S.begin(), m_bsgs.S.end(), std::back_inserter(S_i), stab_i); ^~~~ ../permlib-0.2.8/include/permlib/search/orbit_lex_min_search.h:142:7: note: in instantiation of member function 'permlib::OrbitLexMinSearch<permlib::BSGS<permlib::Permutation, permlib::SchreierTreeTransversal > >::lexMin' requested here if (lexMin(i, element.count(), element, stabilizer, cand0, cand1, M_i, base, S_i)) ^ ../permlib-0.2.8/include/permlib/permlib_api.h:211:19: note: in instantiation of member function 'permlib::OrbitLexMinSearch<permlib::BSGS<permlib::Permutation, permlib::SchreierTreeTransversal > >::lexMin' requested here return orbLexMin.lexMin(set); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1570:1: note: candidate function [with _InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void >, _OutputIterator = std::1::back_insert_iteratorstd::1::vector<boost::shared_ptr<permlib::Permutation, std::1::allocatorboost::shared_ptr > >, _Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] copy_if(_InputIterator first, _InputIterator last, ^ ../permlib-0.2.8/include/permlib/common.h:49:17: note: candidate function [with InputIterator = std::1::__list_iteratorboost::shared_ptr<permlib::Permutation, void >, OutputIterator = std::1::back_insert_iteratorstd::1::vector<boost::shared_ptr<permlib::Permutation, std::__1::allocatorboost::shared_ptr > >, Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator destBegi... ^ In file included from permlib.cpp:3: In file included from ../permlib-0.2.8/include/permlib/permlib_api.h:42: In file included from ../permlib-0.2.8/include/permlib/search/partition/vector_stabilizer_search.h:36: In file included from ../permlib-0.2.8/include/permlib/search/partition/r_base.h:38: In file included from ../permlib-0.2.8/include/permlib/search/base_search.h:37: In file included from ../permlib-0.2.8/include/permlib/change/random_base_transpose.h:36: ../permlib-0.2.8/include/permlib/change/base_transpose.h:99:2: error: call to 'copy_if' is ambiguous std::copy_if(bsgs.S.begin(), bsgs.S.end(), std::back_inserter(S_i), PointwiseStabilize... ^~~~ ../permlib-0.2.8/include/permlib/change/conjugating_base_change.h:99:12: note: in instantiation of member function 'permlib::BaseTranspose<permlib::Permutation, permlib::SchreierTreeTransversal >::transpose' requested here trans.transpose(bsgs, pos-1); ^ ../permlib-0.2.8/include/permlib/search/orbit_lex_min_search.h:218:8: note: in instantiation of function template specialization 'permlib::ConjugatingBaseChange<permlib::Permutation, permlib::SchreierTreeTransversal, permlib::RandomBaseTranspose<permlib::Permutation, permlib::SchreierTreeTransversal >

::change<std::1::list_iterator<unsigned long, void > >' requested here m_cbc.change(m_bsgs, base.begin(), base.end()); ^ ../permlib-0.2.8/include/permlib/search/orbit_lex_min_search.h:142:7: note: in instantiation of member function 'permlib::OrbitLexMinSearch<permlib::BSGS<permlib::Permutation, permlib::SchreierTreeTransversal > >::lexMin' requested here if (lexMin(i, element.count(), element, stabilizer, cand0, cand1, M_i, base, S_i)) ^ ../permlib-0.2.8/include/permlib/permlib_api.h:211:19: note: in instantiation of member function 'permlib::OrbitLexMinSearch<permlib::BSGS<permlib::Permutation, permlib::SchreierTreeTransversal > >::lexMin' requested here return orbLexMin.lexMin(set); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1570:1: note: candidate function [with _InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void >, _OutputIterator = std::1::back_insert_iteratorstd::1::list<boost::shared_ptr<permlib::Permutation, std::1::allocatorboost::shared_ptr > >, _Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] copy_if(_InputIterator first, _InputIterator last, ^ ../permlib-0.2.8/include/permlib/common.h:49:17: note: candidate function [with InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void *>, OutputIterator = std::1::back_insert_iteratorstd::1::list<boost::shared_ptr<permlib::Permutation, std::__1::allocatorboost::shared_ptr > >, Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator destBegi... ^ In file included from permlib.cpp:3: In file included from ../permlib-0.2.8/include/permlib/permlib_api.h:42: In file included from ../permlib-0.2.8/include/permlib/search/partition/vector_stabilizer_search.h:36: In file included from ../permlib-0.2.8/include/permlib/search/partition/r_base.h:38: In file included from ../permlib-0.2.8/include/permlib/search/base_search.h:37: In file included from ../permlib-0.2.8/include/permlib/change/random_base_transpose.h:36: ../permlib-0.2.8/include/permlib/change/base_transpose.h:104:2: error: call to 'copy_if' is ambiguous std::copy_if(bsgs.S.begin(), bsgs.S.end(), std::back_inserter(S_i1), PointwiseStabiliz... ^~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1570:1: note: candidate function [with _InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void *>, _OutputIterator = std::1::back_insert_iteratorstd::1::list<boost::shared_ptr<permlib::Permutation, std::1::allocatorboost::shared_ptr > >, _Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] copy_if(_InputIterator first, _InputIterator last, ^ ../permlib-0.2.8/include/permlib/common.h:49:17: note: candidate function [with InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void *>, OutputIterator = std::1::back_insert_iteratorstd::__1::list<boost::shared_ptr<permlib::Permutation, std::1::allocatorboost::shared_ptr > >, Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator destBegi... ^ In file included from permlib.cpp:3: In file included from ../permlib-0.2.8/include/permlib/permlib_api.h:40: In file included from ../permlib-0.2.8/include/permlib/construct/schreier_sims_construction.h:36: ../permlib-0.2.8/include/permlib/construct/base_construction.h:128:3: error: call to 'copy_if' is ambiguous std::copy_if(nonIdentityGenerators.begin(), nonIdentityGenerators.end(), ^~~~ ../permlib-0.2.8/include/permlib/construct/schreier_sims_construction.h:99:8: note: in instantiation of function template specialization 'permlib::BaseConstruction<permlib::Permutation, permlib::SchreierTreeTransversal ::setupstd::1::list_iterator<boost::shared_ptr<permlib::Permutation, void >, const unsigned long >' requested here this->setup(generatorsBegin, generatorsEnd, prescribedBaseBegin, prescribedBaseEnd, ret, S); ^ ../permlib-0.2.8/include/permlib/construct/schreier_sims_construction.h:86:9: note: in instantiation of function template specialization 'permlib::SchreierSimsConstruction<permlib::Permutation, permlib::SchreierTreeTransversal ::constructstd::1::list_iterator<boost::shared_ptr<permlib::Permutation, void >, const unsigned long >' requested here return construct(generatorsBegin, generatorsEnd, BaseConstruction<PERM,TRANS>::empty, ... ^ ../permlib-0.2.8/include/permlib/permlib_api.h:70:78: note: in instantiation of function template specialization 'permlib::SchreierSimsConstruction<permlib::Permutation, permlib::SchreierTreeTransversal ::constructstd::1::list_iterator<boost::shared_ptr<permlib::Permutation, void > >' requested here boost::shared_ptr group(new PermutationGroup(schreierSims.construct(... ^ permlib.cpp:30:19: note: in instantiation of function template specialization 'permlib::constructstd::1::list_iterator<boost::shared_ptr<permlib::Permutation, void > ' requested here permlib_group = construct(permlib_group_size, permlib_generators.begin(), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1570:1: note: candidate function [with _InputIterator = std::1::list_iteratorboost::shared_ptr<permlib::Permutation, void >, _OutputIterator = std::1::back_insert_iteratorstd::1::list<boost::shared_ptr<permlib::Permutation, std::1::allocatorboost::shared_ptr > >, _Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] copy_if(_InputIterator first, _InputIterator last, ^ ../permlib-0.2.8/include/permlib/common.h:49:17: note: candidate function [with InputIterator = std::1::__list_iteratorboost::shared_ptr<permlib::Permutation, void >, OutputIterator = std::1::back_insert_iteratorstd::1::list<boost::shared_ptr<permlib::Permutation, std::__1::allocatorboost::shared_ptr > >, Predicate = permlib::PointwiseStabilizerPredicatepermlib::Permutation] OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator destBegi... ^ 4 errors generated.

tremlin commented 10 years ago

Hi David,

Thanks for your bug report. Could you please try the new issue-0002 branch of permlib and check whether this solves your problem?

Best, Thomas.

DavidDeharbe commented 10 years ago

Hi Thomas,

Thanks for taking this issue into account! But, your changes do not seem to work on my system.

Meanwhile I spent some time reading forums and documentation to try to come up with a solution. Based on "http://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros", I had changed the problematic section of my local copy of include/permlib/common.h as follows:

if defined(__has_include)

if __has_include()

include

endif

else

ifndef GXX_EXPERIMENTAL_CXX0X

namespace std { /// copies elements of (begin to end) to destBegin if they match the given predicate /* * due to Meyers, Effective STL, p. 157 (Item 36) _/ template<typename InputIterator, typename OutputIterator, typename Predicate> OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator destBegin, Predicate p) { while (begin != end) { if (p(_begin)) destBegin++ = *begin; ++begin; } return destBegin; } }

endif

endif

This solution works for me but I do not know if this is portable to other systems, though. Do you want to give it a try?

Best regards,

-- David.

On Dec 14, 2013, at 11:06 AM, Thomas Rehn notifications@github.com wrote:

Hi David,

Thanks for your bug report. Could you please try the new issue-0002 branch of permlib and check whether this solves your problem?

Best, Thomas.

— Reply to this email directly or view it on GitHub.

tremlin commented 10 years ago

Hi David,

Unfortunately your suggestions breaks compilation in non-C++11 mode with clang on my system. As I do not have a Mac to investigate this issue further and you have found a workaround for yourself, I think I leave it as is.

Best, Thomas.