aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-17 12:33:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-17 12:33:54 +0000
commit763dc12ae16b75aed6a97b16514f6583feef6663 (patch)
treeffebfd6e8acf7c8ebaa280dde1ca1ebdde6a7141
parent34fe5458d12f8c1d7893a89e59a4d2e5f8095980 (diff)
downloadpaludis-763dc12ae16b75aed6a97b16514f6583feef6663.tar.gz
paludis-763dc12ae16b75aed6a97b16514f6583feef6663.tar.xz
Be kinder to stupid compilers: don't rely upon tr1::shared_ptr<> being callable. Don't explicitly instantiate fully specialised templates if the compielr doesn't allow it. Include -impl headers in more places to work around compilers thinking they can ignore explicit instantiations.
-rw-r--r--configure.ac14
-rw-r--r--paludis/args/args_option.cc1
-rw-r--r--paludis/condition_tracker.cc4
-rw-r--r--paludis/environments/paludis/paludis_environment.cc1
-rw-r--r--paludis/environments/portage/portage_environment.cc9
-rw-r--r--paludis/environments/test/test_environment.cc10
-rw-r--r--paludis/literal_metadata_key.cc1
-rw-r--r--paludis/metadata_key.cc19
-rw-r--r--paludis/package_id.cc15
-rw-r--r--paludis/repositories/e/dep_parser.cc8
-rw-r--r--paludis/repositories/e/e_mask.cc1
-rw-r--r--paludis/repositories/e/e_repository.cc2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc30
-rw-r--r--paludis/repositories/e/exheres_layout.cc3
-rw-r--r--paludis/repositories/e/traditional_layout.cc3
-rw-r--r--paludis/repositories/e/vdb_repository.cc10
-rw-r--r--paludis/repositories/fake/fake_package_id.cc6
-rw-r--r--paludis/repository.cc15
-rw-r--r--paludis/util/graph-impl.hh97
-rw-r--r--paludis/util/indirect_iterator.hh2
-rw-r--r--src/clients/adjutrix/command_line.cc1
-rw-r--r--src/clients/adjutrix/keywords_graph.cc2
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc19
23 files changed, 155 insertions, 118 deletions
diff --git a/configure.ac b/configure.ac
index 598ef6e..04b2544 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,20 @@ template <> template <typename T_> struct S<T<T_> > { };
])
dnl }}}
+dnl {{{ check whether we do explicit instantiation of fully specialised templates
+AC_MSG_CHECKING([whether we should explicitly instantiate fully specialised templates])
+AC_COMPILE_IFELSE([
+template <typename T_> struct S;
+template <> struct S<int>;
+template class S<int>;
+],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_NO_EXPLICIT_FULLY_SPECIALISED=1"
+ PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_NO_EXPLICIT_FULLY_SPECIALISED=1"
+ ])
+dnl }}}
+
dnl {{{ check for static_assert
AC_MSG_CHECKING([for compiler support for static_assert])
AC_COMPILE_IFELSE([
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index d9f1f13..821cff4 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -21,6 +21,7 @@
#include "args_error.hh"
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/visitor-impl.hh>
#include <set>
#include <vector>
#include <algorithm>
diff --git a/paludis/condition_tracker.cc b/paludis/condition_tracker.cc
index a07f3f3..8f2dbab 100644
--- a/paludis/condition_tracker.cc
+++ b/paludis/condition_tracker.cc
@@ -30,7 +30,7 @@ ConditionTracker::ConditionTracker(
tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > conditions) :
base(new ConstTreeSequence<DependencySpecTree, AllDepSpec>(
tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
- adder(tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, base, _1))
+ adder(tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, base.get(), _1))
{
conditions->accept(*this);
}
@@ -93,7 +93,7 @@ ConditionTracker::do_visit_sequence(const T_ & node,
new ConstTreeSequence<DependencySpecTree, T_>(
tr1::static_pointer_cast<T_>(node.clone())));
adder(a);
- adder = tr1::bind(&ConstTreeSequence<DependencySpecTree, T_>::add, a, _1);
+ adder = tr1::bind(&ConstTreeSequence<DependencySpecTree, T_>::add, a.get(), _1);
if (begin != end)
{
begin->accept(*this);
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 7d2b8dd..22c0ebf 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -51,6 +51,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/visitor-impl.hh>
#include <functional>
#include <algorithm>
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 90074d5..8f8b239 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -34,6 +34,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/repository_maker.hh>
#include <paludis/util/config_file.hh>
#include <paludis/hooker.hh>
@@ -271,8 +272,8 @@ PortageEnvironment::_load_atom_file(const FSEntry & f, I_ i, const std::string &
if (f.is_directory())
{
- std::for_each(DirIterator(f), DirIterator(), tr1::bind(tr1::mem_fn(
- &PortageEnvironment::_load_atom_file<I_>), this, _1, i, def_value));
+ std::for_each(DirIterator(f), DirIterator(), tr1::bind(
+ &PortageEnvironment::_load_atom_file<I_>, this, _1, i, def_value));
}
else
{
@@ -315,8 +316,8 @@ PortageEnvironment::_load_lined_file(const FSEntry & f, I_ i)
if (f.is_directory())
{
- std::for_each(DirIterator(f), DirIterator(), tr1::bind(tr1::mem_fn(
- &PortageEnvironment::_load_lined_file<I_>), this, _1, i));
+ std::for_each(DirIterator(f), DirIterator(), tr1::bind(
+ &PortageEnvironment::_load_lined_file<I_>, this, _1, i));
}
else
{
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index a42834c..bca0957 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -105,11 +105,11 @@ TestEnvironment::fetch_package_id(const QualifiedPackageName & q,
using namespace tr1::placeholders;
tr1::shared_ptr<const PackageIDSequence> ids(package_database()->fetch_repository(r)->package_ids(q));
- PackageIDSequence::ConstIterator i(std::find_if(ids->begin(), ids->end(),
- tr1::bind(std::equal_to<VersionSpec>(), tr1::bind(tr1::mem_fn(&PackageID::version), _1), v)));
- if (i == ids->end())
- throw NoSuchPackageError(stringify(q) + "-" + stringify(v) + "::" + stringify(r));
- return *i;
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ if (v == (*i)->version())
+ return *i;
+ throw NoSuchPackageError(stringify(q) + "-" + stringify(v) + "::" + stringify(r));
}
tr1::shared_ptr<SetSpecTree::ConstItem>
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 2ac2226..74698a1 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -24,6 +24,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/formatter.hh>
#include <paludis/package_id.hh>
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index e4c2edf..93896ce 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -25,6 +25,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/name.hh>
#include <list>
#include <algorithm>
@@ -133,7 +134,7 @@ MetadataSectionKey::add_metadata_key(const tr1::shared_ptr<const MetadataKey> &
{
using namespace tr1::placeholders;
- if (_imp->keys.end() != std::find_if(_imp->keys.begin(), _imp->keys.end(),
+ if (indirect_iterator(_imp->keys.end()) != std::find_if(indirect_iterator(_imp->keys.begin()), indirect_iterator(_imp->keys.end()),
tr1::bind(std::equal_to<std::string>(), k->raw_name(), tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1))))
throw ConfigurationError("Tried to add duplicate key '" + k->raw_name() + "'");
@@ -160,8 +161,16 @@ MetadataSectionKey::find_metadata(const std::string & s) const
using namespace tr1::placeholders;
need_keys_added();
- return std::find_if(begin_metadata(), end_metadata(),
- tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ // tr1::mem_fn on a sptr doesn't work with boost
+ // return std::find_if(begin_metadata(), end_metadata(),
+ // tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ for (MetadataConstIterator i(begin_metadata()), i_end(end_metadata()) ;
+ i != i_end ; ++i)
+ if ((*i)->raw_name() == s)
+ return i;
+ return end_metadata();
}
template <typename C_>
@@ -187,7 +196,9 @@ MetadataSpecTreeKey<FetchableURISpecTree>::MetadataSpecTreeKey(const std::string
}
template class MetadataCollectionKey<KeywordNameSet>;
+#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class MetadataCollectionKey<IUseFlagSet>;
+#endif
template class MetadataCollectionKey<Set<std::string> >;
template class MetadataCollectionKey<UseFlagNameSet>;
template class MetadataCollectionKey<PackageIDSequence>;
@@ -197,6 +208,8 @@ template class MetadataSpecTreeKey<LicenseSpecTree>;
template class MetadataSpecTreeKey<ProvideSpecTree>;
template class MetadataSpecTreeKey<DependencySpecTree>;
template class MetadataSpecTreeKey<RestrictSpecTree>;
+#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class MetadataSpecTreeKey<FetchableURISpecTree>;
+#endif
template class MetadataSpecTreeKey<SimpleURISpecTree>;
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index 573bab0..02f85d5 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -26,6 +26,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator-impl.hh>
#include <paludis/name.hh>
@@ -80,7 +81,7 @@ PackageID::add_metadata_key(const tr1::shared_ptr<const MetadataKey> & k) const
{
using namespace tr1::placeholders;
- if (_imp->keys.end() != std::find_if(_imp->keys.begin(), _imp->keys.end(),
+ if (indirect_iterator(_imp->keys.end()) != std::find_if(indirect_iterator(_imp->keys.begin()), indirect_iterator(_imp->keys.end()),
tr1::bind(std::equal_to<std::string>(), k->raw_name(), tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1))))
throw ConfigurationError("Tried to add duplicate key '" + k->raw_name() + "' to ID '" + stringify(*this) + "'");
@@ -139,8 +140,16 @@ PackageID::find_metadata(const std::string & s) const
using namespace tr1::placeholders;
need_keys_added();
- return std::find_if(begin_metadata(), end_metadata(),
- tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ // tr1::mem_fn on a sptr doesn't work with boost
+ // return std::find_if(begin_metadata(), end_metadata(),
+ // tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ for (MetadataConstIterator i(begin_metadata()), i_end(end_metadata()) ;
+ i != i_end ; ++i)
+ if ((*i)->raw_name() == s)
+ return i;
+ return end_metadata();
}
std::ostream &
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index df96853..e3bf493 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -236,7 +236,7 @@ namespace
new UseDepSpec(UseFlagName(f), inv))));
stack.top().first(a);
stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, UseDepSpec>::add, a, _1)), false));
+ tr1::bind(&ConstTreeSequence<H_, UseDepSpec>::add, a.get(), _1)), false));
}
};
@@ -260,7 +260,7 @@ namespace
tr1::shared_ptr<AnyDepSpec>(new AnyDepSpec)));
stack.top().first(a);
stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, AnyDepSpec>::add, a, _1)), true));
+ tr1::bind(&ConstTreeSequence<H_, AnyDepSpec>::add, a.get(), _1)), true));
}
};
@@ -342,7 +342,7 @@ namespace
new ConstTreeSequence<H_, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
std::stack<std::pair<tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>, bool> > stack;
stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, result, _1)), false));
+ tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, result.get(), _1)), false));
std::string arrow_lhs;
DepParserState state(dps_initial);
@@ -392,7 +392,7 @@ namespace
tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
stack.top().first(a);
stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, a, _1)), false));
+ tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, a.get(), _1)), false));
state = dps_had_paren;
}
continue;
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
index 06623f3..7412dda 100644
--- a/paludis/repositories/e/e_mask.cc
+++ b/paludis/repositories/e/e_mask.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/repositories/e/e_mask.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
using namespace paludis;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index b220f54..a5b8b0c 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -150,7 +150,7 @@ namespace
{
using namespace tr1::placeholders;
tr1::shared_ptr<Set<std::string> > s(new Set<std::string>);
- std::transform(q->begin(), q->end(), s->inserter(),
+ std::transform(indirect_iterator(q->begin()), indirect_iterator(q->end()), s->inserter(),
tr1::bind(tr1::mem_fn(&PackageID::canonical_form), _1, idcf_version));
key.reset(new LiteralMetadataStringSetKey(*i, *i, mkt_normal, s));
}
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 7294bd1..bafed93 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -47,6 +47,7 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <fstream>
#include <list>
@@ -181,18 +182,6 @@ namespace
namespace
{
- FSEntry
- get_root(tr1::shared_ptr<const DestinationsSet> destinations)
- {
- if (destinations)
- for (DestinationsSet::ConstIterator d(destinations->begin()), d_end(destinations->end()) ;
- d != d_end ; ++d)
- if ((*d)->installed_root_key())
- return ((*d)->installed_root_key()->value());
-
- return FSEntry("/");
- }
-
std::string make_use(const Environment * const env,
const ERepositoryID & id,
tr1::shared_ptr<const ERepositoryProfile> profile)
@@ -446,9 +435,9 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
id->restrict_key()->value()->accept(restricts);
userpriv_restrict =
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
}
@@ -633,19 +622,6 @@ EbuildEntries::info(const tr1::shared_ptr<const ERepositoryID> & id,
Context context("When infoing '" + stringify(*id) + "':");
- bool userpriv_restrict;
- {
- DepSpecFlattener<RestrictSpecTree, PlainTextDepSpec> restricts(_imp->params.environment, *id);
- if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
-
- userpriv_restrict =
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
- tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
- tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
- }
-
/* make use */
std::string use(make_use(_imp->params.environment, *id, p));
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index b195504..ff91257 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -30,6 +30,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/map.hh>
#include <paludis/util/mutex.hh>
@@ -196,7 +197,7 @@ ExheresLayout::need_package_ids(const QualifiedPackageName & n) const
try
{
tr1::shared_ptr<const PackageID> id(_imp->entries->make_id(n, _imp->entries->extract_package_file_version(n, *e), *e, ""));
- if (v->end() != std::find_if(v->begin(), v->end(),
+ if (indirect_iterator(v->end()) != std::find_if(indirect_iterator(v->begin()), indirect_iterator(v->end()),
tr1::bind(std::equal_to<VersionSpec>(), id->version(), tr1::bind(tr1::mem_fn(&PackageID::version), _1))))
Log::get_instance()->message(ll_warning, lc_context, "Ignoring entry '" + stringify(*e)
+ "' for '" + stringify(n) + "' in repository '" + stringify(_imp->repository->name())
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index acad127..31beab8 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -38,6 +38,7 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/tr1_functional.hh>
#include <functional>
@@ -214,7 +215,7 @@ TraditionalLayout::need_package_ids(const QualifiedPackageName & n) const
try
{
tr1::shared_ptr<const PackageID> id(_imp->entries->make_id(n, _imp->entries->extract_package_file_version(n, *e), *e, ""));
- if (v->end() != std::find_if(v->begin(), v->end(),
+ if (indirect_iterator(v->end()) != std::find_if(indirect_iterator(v->begin()), indirect_iterator(v->end()),
tr1::bind(std::equal_to<VersionSpec>(), id->version(), tr1::bind(tr1::mem_fn(&PackageID::version), _1))))
Log::get_instance()->message(ll_warning, lc_context, "Ignoring entry '" + stringify(*e)
+ "' for '" + stringify(n) + "' in repository '" + stringify(_imp->repository->name())
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 8e1c25b..5a9d97b 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -1258,11 +1258,11 @@ VDBRepository::package_id_if_exists(const QualifiedPackageName & q, const Versio
using namespace tr1::placeholders;
- PackageIDSequence::ConstIterator i(std::find_if(_imp->ids[q]->begin(), _imp->ids[q]->end(),
- tr1::bind(std::equal_to<VersionSpec>(), v, tr1::bind(tr1::mem_fn(&PackageID::version), _1))));
- if (_imp->ids[q]->end() == i)
- return tr1::shared_ptr<const ERepositoryID>();
- return tr1::static_pointer_cast<const ERepositoryID>(*i);
+ PackageIDSequence::ConstIterator i(_imp->ids[q]->begin()), i_end(_imp->ids[q]->end());
+ for ( ; i != i_end ; ++i)
+ if (v == (*i)->version())
+ return tr1::static_pointer_cast<const ERepositoryID>(*i);
+ return tr1::shared_ptr<const ERepositoryID>();
}
namespace
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 48de5c5..adef75c 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -46,7 +46,9 @@ using namespace paludis;
namespace paludis
{
+#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
+#endif
template <typename C_>
struct Implementation<FakeMetadataCollectionKey<C_> >
{
@@ -120,7 +122,9 @@ FakeMetadataIUseSetKey::set_from_string(const std::string & s, const IUseFlagPar
namespace paludis
{
+#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
+#endif
template <typename C_>
struct Implementation<FakeMetadataSpecTreeKey<C_> >
{
@@ -902,7 +906,9 @@ template class FakeMetadataSpecTreeKey<LicenseSpecTree>;
template class FakeMetadataSpecTreeKey<ProvideSpecTree>;
template class FakeMetadataSpecTreeKey<DependencySpecTree>;
template class FakeMetadataSpecTreeKey<RestrictSpecTree>;
+#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class FakeMetadataSpecTreeKey<FetchableURISpecTree>;
+#endif
template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
template class FakeMetadataCollectionKey<KeywordNameSet>;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 862cc9d..89e7374 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -22,6 +22,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/sequence.hh>
@@ -137,7 +138,7 @@ Repository::add_metadata_key(const tr1::shared_ptr<const MetadataKey> & k) const
{
using namespace tr1::placeholders;
- if (_imp->keys.end() != std::find_if(_imp->keys.begin(), _imp->keys.end(),
+ if (indirect_iterator(_imp->keys.end()) != std::find_if(indirect_iterator(_imp->keys.begin()), indirect_iterator(_imp->keys.end()),
tr1::bind(std::equal_to<std::string>(), k->raw_name(), tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1))))
throw ConfigurationError("Tried to add duplicate key '" + k->raw_name() + "' to Repository '" + stringify(name()) + "'");
@@ -170,8 +171,16 @@ Repository::find_metadata(const std::string & s) const
using namespace tr1::placeholders;
need_keys_added();
- return std::find_if(begin_metadata(), end_metadata(),
- tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ // tr1::mem_fn on a sptr doesn't work with boost
+ // return std::find_if(begin_metadata(), end_metadata(),
+ // tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
+
+ for (MetadataConstIterator i(begin_metadata()), i_end(end_metadata()) ;
+ i != i_end ; ++i)
+ if ((*i)->raw_name() == s)
+ return i;
+ return end_metadata();
}
tr1::shared_ptr<const CategoryNamePartSet>
diff --git a/paludis/util/graph-impl.hh b/paludis/util/graph-impl.hh
index 08e3b73..7fb645f 100644
--- a/paludis/util/graph-impl.hh
+++ b/paludis/util/graph-impl.hh
@@ -321,65 +321,66 @@ namespace paludis
return ! i->second.empty();
}
- template <typename Node_, typename Edge_>
- template <typename OutputConstIterator_>
- void
- DirectedGraph<Node_, Edge_>::topological_sort(OutputConstIterator_ x) const
+ template <typename Node_, typename Edge_, typename OutputConstIterator_>
+ struct DirectedGraphTopologicalSorter
{
- struct Sorter
+ DirectedGraph<Node_, Edge_> g;
+ std::set<Node_> done;
+
+ DirectedGraphTopologicalSorter(const DirectedGraph<Node_, Edge_> & gg) :
+ g(gg)
{
- DirectedGraph g;
- std::set<Node_> done;
+ }
- Sorter(const DirectedGraph & gg) :
- g(gg)
- {
- }
+ void do_one(OutputConstIterator_ & i, const Node_ & n)
+ {
+ if (done.end() != done.find(n))
+ return;
- void do_one(OutputConstIterator_ & i, const Node_ & n)
- {
- if (done.end() != done.find(n))
- return;
-
- if (g.has_outgoing_edges(n))
- return;
-
- *i++ = n;
- done.insert(n);
-
- for (typename DirectedGraph::NodeConstIterator m(g.begin_nodes()), m_end(g.end_nodes()) ; m != m_end ; )
- if (g.has_edge(*m, n))
- {
- g.delete_edge(*m, n);
- do_one(i, *m++);
- }
- else
- ++m;
- }
+ if (g.has_outgoing_edges(n))
+ return;
- void sort(OutputConstIterator_ & i)
- {
- unsigned c(0);
- for (typename DirectedGraph::NodeConstIterator n(g.begin_nodes()), n_end(g.end_nodes()) ; n != n_end ; )
+ *i++ = n;
+ done.insert(n);
+
+ for (typename DirectedGraph<Node_, Edge_>::NodeConstIterator m(g.begin_nodes()), m_end(g.end_nodes()) ; m != m_end ; )
+ if (g.has_edge(*m, n))
{
- ++c;
- do_one(i, *n++);
+ g.delete_edge(*m, n);
+ do_one(i, *m++);
}
+ else
+ ++m;
+ }
- if (done.size() < c)
- {
- tr1::shared_ptr<NoGraphTopologicalOrderExistsError::RemainingNodes> r(
- new NoGraphTopologicalOrderExistsError::RemainingNodes);
- for (typename DirectedGraph::NodeConstIterator n(g.begin_nodes()), n_end(g.end_nodes()) ; n != n_end ; ++n)
- if (done.end() == done.find(*n))
- r->add(stringify(*n));
+ void sort(OutputConstIterator_ & i)
+ {
+ unsigned c(0);
+ for (typename DirectedGraph<Node_, Edge_>::NodeConstIterator n(g.begin_nodes()), n_end(g.end_nodes()) ; n != n_end ; )
+ {
+ ++c;
+ do_one(i, *n++);
+ }
- throw NoGraphTopologicalOrderExistsError(r);
- }
+ if (done.size() < c)
+ {
+ tr1::shared_ptr<NoGraphTopologicalOrderExistsError::RemainingNodes> r(
+ new NoGraphTopologicalOrderExistsError::RemainingNodes);
+ for (typename DirectedGraph<Node_, Edge_>::NodeConstIterator n(g.begin_nodes()), n_end(g.end_nodes()) ; n != n_end ; ++n)
+ if (done.end() == done.find(*n))
+ r->add(stringify(*n));
+
+ throw NoGraphTopologicalOrderExistsError(r);
}
- };
+ }
+ };
- Sorter s(*this);
+ template <typename Node_, typename Edge_>
+ template <typename OutputConstIterator_>
+ void
+ DirectedGraph<Node_, Edge_>::topological_sort(OutputConstIterator_ x) const
+ {
+ DirectedGraphTopologicalSorter<Node_, Edge_, OutputConstIterator_> s(*this);
s.sort(x);
}
}
diff --git a/paludis/util/indirect_iterator.hh b/paludis/util/indirect_iterator.hh
index 6bf5ce0..5956b56 100644
--- a/paludis/util/indirect_iterator.hh
+++ b/paludis/util/indirect_iterator.hh
@@ -94,7 +94,7 @@ namespace paludis
typedef typename tr1::remove_reference<Value_>::type & reference;
typedef typename tr1::remove_reference<Value_>::type * pointer;
typedef std::ptrdiff_t difference_type;
- typedef typename std::iterator_traits<Iter_>::iterator_category iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
///\}
diff --git a/src/clients/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc
index faf9a68..503f4b9 100644
--- a/src/clients/adjutrix/command_line.cc
+++ b/src/clients/adjutrix/command_line.cc
@@ -20,6 +20,7 @@
#include "command_line.hh"
#include <paludis/name.hh>
#include <paludis/util/instantiation_policy-impl.hh>
+#include <paludis/util/visitor-impl.hh>
template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>;
diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc
index 4407261..ac4cdc4 100644
--- a/src/clients/adjutrix/keywords_graph.cc
+++ b/src/clients/adjutrix/keywords_graph.cc
@@ -93,7 +93,7 @@ namespace
return;
std::set<SlotName> slots;
- std::transform(packages->begin(), packages->end(),
+ std::transform(indirect_iterator(packages->begin()), indirect_iterator(packages->end()),
std::inserter(slots, slots.begin()),
tr1::mem_fn(&PackageID::slot));
diff --git a/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc b/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
index 3fad117..95c0b37 100644
--- a/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
@@ -36,6 +36,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/member_iterator-impl.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/contents.hh>
#include <paludis/environment.hh>
@@ -162,14 +163,14 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::str
it_end(_imp->extra_lib_dirs.end()); it_end != it; ++it)
{
Log::get_instance()->message(ll_debug, lc_context, "Need to check for extra libraries in '" + stringify(env->root() / *it) + "'");
- std::for_each(_imp->checkers.begin(), _imp->checkers.end(),
- tr1::bind(&LinkageChecker::add_extra_lib_dir, _1, env->root() / *it));
+ std::for_each(indirect_iterator(_imp->checkers.begin()), indirect_iterator(_imp->checkers.end()),
+ tr1::bind(&LinkageChecker::add_extra_lib_dir, _1, env->root() / *it));
}
tr1::function<void (const FSEntry &, const std::string &)> callback(
tr1::bind(&Implementation<BrokenLinkageFinder>::add_breakage, _imp.get(), _1, _2));
- std::for_each(_imp->checkers.begin(), _imp->checkers.end(),
- tr1::bind(&LinkageChecker::need_breakage_added, _1, callback));
+ std::for_each(indirect_iterator(_imp->checkers.begin()), indirect_iterator(_imp->checkers.end()),
+ tr1::bind(&LinkageChecker::need_breakage_added, _1, callback));
_imp->checkers.clear();
}
@@ -240,17 +241,17 @@ Implementation<BrokenLinkageFinder>::check_file(const FSEntry & file)
{
FSEntry target(dereference_with_root(file, env->root()));
if (target.is_regular_file())
- std::for_each(checkers.begin(), checkers.end(),
- tr1::bind(&LinkageChecker::note_symlink, _1, file, target));
+ std::for_each(indirect_iterator(checkers.begin()), indirect_iterator(checkers.end()),
+ tr1::bind(&LinkageChecker::note_symlink, _1, file, target));
}
else if (file.is_directory())
walk_directory(file);
else if (file.is_regular_file())
- if (checkers.end() ==
- std::find_if(checkers.begin(), checkers.end(),
- tr1::bind(&LinkageChecker::check_file, _1, file)))
+ if (indirect_iterator(checkers.end()) ==
+ std::find_if(indirect_iterator(checkers.begin()), indirect_iterator(checkers.end()),
+ tr1::bind(&LinkageChecker::check_file, _1, file)))
Log::get_instance()->message(ll_debug, lc_context, "'" + stringify(file) + "' is not a recognised file type");
}
catch (const FSError & ex)