opnsense-ports/security/cryptopp/files/patch-nbtheory.cpp
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

21 lines
741 B
C++

--- nbtheory.cpp.orig 2013-05-22 00:16:26.761193859 +0000
+++ nbtheory.cpp 2013-05-22 00:15:29.401256454 +0000
@@ -307,7 +307,18 @@
bool PrimeSieve::NextCandidate(Integer &c)
{
+#if defined(__clang__) && defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 1101
+ // Workaround for a bug in libc++ in std::find on std::vector<bool>
+ std::vector<bool>::iterator pos = m_sieve.begin()+m_next;
+ for (std::vector<bool>::iterator end = m_sieve.end(); pos != end; ++pos)
+ {
+ if (*pos == false)
+ break;
+ }
+ bool safe = SafeConvert(pos - m_sieve.begin(), m_next);
+#else
bool safe = SafeConvert(std::find(m_sieve.begin()+m_next, m_sieve.end(), false) - m_sieve.begin(), m_next);
+#endif
assert(safe);
if (m_next == m_sieve.size())
{