aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-12 16:34:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-12 16:34:29 +0200
commit4fd0df2573341824eea5edfaf45be33997ce56ce (patch)
tree71338eb0045c9eb734178cafb2fabd128d4076da
parent2c58968b94f348911372e8afb47626d33825757b (diff)
<types>/<utility> scheme cleanup
-rw-r--r--bpkg/bpkg.cxx3
-rw-r--r--bpkg/cfg-add2
-rw-r--r--bpkg/cfg-add.cxx4
-rw-r--r--bpkg/cfg-create2
-rw-r--r--bpkg/cfg-create.cxx2
-rw-r--r--bpkg/cfg-fetch2
-rw-r--r--bpkg/cfg-fetch.cxx3
-rw-r--r--bpkg/database9
-rw-r--r--bpkg/database.cxx2
-rw-r--r--bpkg/diagnostics35
-rw-r--r--bpkg/diagnostics.cxx2
-rw-r--r--bpkg/fetch2
-rw-r--r--bpkg/help6
-rw-r--r--bpkg/help.cxx5
-rw-r--r--bpkg/manifest-utility.cxx2
-rw-r--r--bpkg/package16
-rw-r--r--bpkg/package.cxx2
-rw-r--r--bpkg/pkg-build2
-rw-r--r--bpkg/pkg-build.cxx6
-rw-r--r--bpkg/pkg-clean2
-rw-r--r--bpkg/pkg-command2
-rw-r--r--bpkg/pkg-command.cxx2
-rw-r--r--bpkg/pkg-configure2
-rw-r--r--bpkg/pkg-configure.cxx2
-rw-r--r--bpkg/pkg-disfigure2
-rw-r--r--bpkg/pkg-disfigure.cxx2
-rw-r--r--bpkg/pkg-drop2
-rw-r--r--bpkg/pkg-drop.cxx4
-rw-r--r--bpkg/pkg-fetch2
-rw-r--r--bpkg/pkg-fetch.cxx2
-rw-r--r--bpkg/pkg-install2
-rw-r--r--bpkg/pkg-purge2
-rw-r--r--bpkg/pkg-purge.cxx2
-rw-r--r--bpkg/pkg-status2
-rw-r--r--bpkg/pkg-status.cxx3
-rw-r--r--bpkg/pkg-test2
-rw-r--r--bpkg/pkg-uninstall2
-rw-r--r--bpkg/pkg-unpack2
-rw-r--r--bpkg/pkg-unpack.cxx2
-rw-r--r--bpkg/pkg-update2
-rw-r--r--bpkg/pkg-verify2
-rw-r--r--bpkg/pkg-verify.cxx2
-rw-r--r--bpkg/rep-create2
-rw-r--r--bpkg/rep-create.cxx4
-rw-r--r--bpkg/rep-info2
-rw-r--r--bpkg/rep-info.cxx3
-rw-r--r--bpkg/satisfaction3
-rw-r--r--bpkg/types41
-rw-r--r--bpkg/utility22
-rw-r--r--bpkg/utility.cxx5
50 files changed, 120 insertions, 118 deletions
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx
index 8d4d1fb..c94dde9 100644
--- a/bpkg/bpkg.cxx
+++ b/bpkg/bpkg.cxx
@@ -4,12 +4,11 @@
#include <cstring> // strcmp()
#include <iostream>
-#include <exception>
#include <bpkg/types>
#include <bpkg/utility>
-#include <bpkg/diagnostics>
+#include <bpkg/diagnostics>
#include <bpkg/bpkg-options>
#include <bpkg/bpkg-version>
diff --git a/bpkg/cfg-add b/bpkg/cfg-add
index 5d0e3af..eec8859 100644
--- a/bpkg/cfg-add
+++ b/bpkg/cfg-add
@@ -6,6 +6,8 @@
#define BPKG_CFG_ADD
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/cfg-add-options>
namespace bpkg
diff --git a/bpkg/cfg-add.cxx b/bpkg/cfg-add.cxx
index 2a233a1..13a306e 100644
--- a/bpkg/cfg-add.cxx
+++ b/bpkg/cfg-add.cxx
@@ -4,12 +4,8 @@
#include <bpkg/cfg-add>
-#include <stdexcept> // invalid_argument
-
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
#include <bpkg/manifest-utility>
diff --git a/bpkg/cfg-create b/bpkg/cfg-create
index 1d20757..1099b91 100644
--- a/bpkg/cfg-create
+++ b/bpkg/cfg-create
@@ -6,6 +6,8 @@
#define BPKG_CFG_CREATE
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/cfg-create-options>
namespace bpkg
diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx
index 62b39d8..760c644 100644
--- a/bpkg/cfg-create.cxx
+++ b/bpkg/cfg-create.cxx
@@ -6,10 +6,8 @@
#include <fstream>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/cfg-fetch b/bpkg/cfg-fetch
index 394fec7..57a4095 100644
--- a/bpkg/cfg-fetch
+++ b/bpkg/cfg-fetch
@@ -6,6 +6,8 @@
#define BPKG_CFG_FETCH
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/cfg-fetch-options>
namespace bpkg
diff --git a/bpkg/cfg-fetch.cxx b/bpkg/cfg-fetch.cxx
index d90ab93..f35d081 100644
--- a/bpkg/cfg-fetch.cxx
+++ b/bpkg/cfg-fetch.cxx
@@ -5,15 +5,12 @@
#include <bpkg/cfg-fetch>
#include <fstream>
-#include <stdexcept>
#include <bpkg/manifest>
#include <bpkg/fetch>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/database b/bpkg/database
index 0781bf9..b9b9943 100644
--- a/bpkg/database
+++ b/bpkg/database
@@ -5,7 +5,6 @@
#ifndef BPKG_DATABASE
#define BPKG_DATABASE
-#include <utility> // forward()
#include <type_traits> // remove_reference
#include <odb/query.hxx>
@@ -15,6 +14,8 @@
#include <odb/sqlite/database.hxx>
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/diagnostics>
namespace bpkg
@@ -51,7 +52,7 @@ namespace bpkg
R r_;
public:
- pointer_result_range (R&& r): r_ (std::forward<R> (r)) {}
+ pointer_result_range (R&& r): r_ (forward<R> (r)) {}
using base_iterator = typename std::remove_reference<R>::type::iterator;
@@ -60,7 +61,7 @@ namespace bpkg
iterator () = default;
explicit
- iterator (base_iterator i): base_iterator (std::move (i)) {}
+ iterator (base_iterator i): base_iterator (move (i)) {}
typename base_iterator::pointer_type
operator* () {return this->load ();}
@@ -74,7 +75,7 @@ namespace bpkg
inline pointer_result_range<R>
pointer_result (R&& r)
{
- return pointer_result_range<R> (std::forward<R> (r));
+ return pointer_result_range<R> (forward<R> (r));
}
}
diff --git a/bpkg/database.cxx b/bpkg/database.cxx
index a6168b0..54672d1 100644
--- a/bpkg/database.cxx
+++ b/bpkg/database.cxx
@@ -7,8 +7,6 @@
#include <odb/schema-catalog.hxx>
#include <odb/sqlite/exceptions.hxx>
-#include <bpkg/types>
-#include <bpkg/utility>
#include <bpkg/diagnostics>
using namespace std;
diff --git a/bpkg/diagnostics b/bpkg/diagnostics
index e47a2fd..9a2118f 100644
--- a/bpkg/diagnostics
+++ b/bpkg/diagnostics
@@ -5,12 +5,7 @@
#ifndef BPKG_DIAGNOSTICS
#define BPKG_DIAGNOSTICS
-#include <string>
-#include <cstdint>
-#include <utility> // forward()
#include <sstream>
-#include <ostream>
-#include <exception>
#include <odb/tracer.hxx>
@@ -37,10 +32,10 @@ namespace bpkg
// nameN arg arg ... nullptr nullptr
//
void
- print_process (diag_record&, const char* const args[], std::size_t n = 0);
+ print_process (diag_record&, const char* const args[], size_t n = 0);
void
- print_process (const char* const args[], std::size_t n = 0);
+ print_process (const char* const args[], size_t n = 0);
inline void
print_process (diag_record& dr, const cstrings& args)
@@ -77,7 +72,7 @@ namespace bpkg
// Diagnostic facility, base infrastructure (potentially reusable).
//
- extern std::ostream* diag_stream;
+ extern ostream* diag_stream;
template <typename> struct diag_prologue;
template <typename> struct diag_mark;
@@ -129,7 +124,7 @@ namespace bpkg
@@ libstdc++ doesn't yet have the ostringstream move support.
diag_record (diag_record&& r)
- : os_ (std::move (r.os_))
+ : os_ (move (r.os_))
{
empty_ = r.empty_;
r.empty_ = true;
@@ -172,11 +167,11 @@ namespace bpkg
template <typename... A>
diag_prologue (A&&... a)
- : B (std::forward<A> (a)...), epilogue_ (nullptr) {}
+ : B (forward<A> (a)...), epilogue_ (nullptr) {}
template <typename... A>
diag_prologue (diag_epilogue e, A&&... a)
- : B (std::forward<A> (a)...), epilogue_ (e) {}
+ : B (forward<A> (a)...), epilogue_ (e) {}
template <typename T>
diag_record
@@ -207,7 +202,7 @@ namespace bpkg
diag_mark (): B () {}
template <typename... A>
- diag_mark (A&&... a): B (std::forward<A> (a)...) {}
+ diag_mark (A&&... a): B (forward<A> (a)...) {}
template <typename T>
diag_record
@@ -244,12 +239,12 @@ namespace bpkg
{
public:
location () {}
- location (string f, std::uint64_t l, std::uint64_t c)
- : file (std::move (f)), line (l), column (c) {}
+ location (string f, uint64_t l, uint64_t c)
+ : file (move (f)), line (l), column (c) {}
string file;
- std::uint64_t line;
- std::uint64_t column;
+ uint64_t line;
+ uint64_t column;
};
struct location_prologue_base
@@ -303,9 +298,7 @@ namespace bpkg
return location_prologue (
type_,
name_,
- location (std::forward<F> (f),
- std::forward<L> (l),
- std::forward<C> (c)));
+ location (forward<F> (f), forward<L> (l), forward<C> (c)));
}
protected:
@@ -382,9 +375,7 @@ namespace bpkg
&epilogue,
"error",
nullptr,
- location (std::forward<F> (f),
- std::forward<L> (l),
- std::forward<C> (c)));
+ location (forward<F> (f), forward<L> (l), forward<C> (c)));
}
static void
diff --git a/bpkg/diagnostics.cxx b/bpkg/diagnostics.cxx
index e228a8b..41f08b4 100644
--- a/bpkg/diagnostics.cxx
+++ b/bpkg/diagnostics.cxx
@@ -9,8 +9,6 @@
#include <odb/statement.hxx>
-#include <bpkg/utility>
-
using namespace std;
namespace bpkg
diff --git a/bpkg/fetch b/bpkg/fetch
index 06c2d15..2867243 100644
--- a/bpkg/fetch
+++ b/bpkg/fetch
@@ -5,8 +5,6 @@
#ifndef BPKG_FETCH
#define BPKG_FETCH
-#include <exception>
-
#include <bpkg/manifest>
#include <bpkg/types>
diff --git a/bpkg/help b/bpkg/help
index 1cad767..6026cc4 100644
--- a/bpkg/help
+++ b/bpkg/help
@@ -5,14 +5,14 @@
#ifndef BPKG_HELP
#define BPKG_HELP
-#include <iosfwd>
-
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/help-options>
namespace bpkg
{
- using usage_function = cli::usage_para (std::ostream&, cli::usage_para);
+ using usage_function = cli::usage_para (ostream&, cli::usage_para);
int
help (const help_options&, const string& topic, usage_function* usage);
diff --git a/bpkg/help.cxx b/bpkg/help.cxx
index 587a7c7..8713426 100644
--- a/bpkg/help.cxx
+++ b/bpkg/help.cxx
@@ -4,14 +4,9 @@
#include <bpkg/help>
-#include <system_error>
-
#include <butl/pager>
-#include <bpkg/types>
-#include <bpkg/utility>
#include <bpkg/diagnostics>
-
#include <bpkg/bpkg-options>
using namespace std;
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx
index c819060..5aa90b9 100644
--- a/bpkg/manifest-utility.cxx
+++ b/bpkg/manifest-utility.cxx
@@ -4,8 +4,6 @@
#include <bpkg/manifest-utility>
-#include <stdexcept> // invalid_argument
-
#include <bpkg/diagnostics>
using namespace std;
diff --git a/bpkg/package b/bpkg/package
index ad465e9..d227929 100644
--- a/bpkg/package
+++ b/bpkg/package
@@ -7,10 +7,6 @@
#include <map>
#include <set>
-#include <vector>
-#include <cstdint> // uint16
-#include <ostream>
-#include <utility> // pair
#include <odb/core.hxx>
#include <odb/nested-container.hxx>
@@ -257,7 +253,7 @@ namespace bpkg
#pragma db member(dependency::constraint) column("")
#pragma db value(dependency_alternatives) definition
- using dependencies = std::vector<dependency_alternatives>;
+ using dependencies = vector<dependency_alternatives>;
// available_package
//
@@ -294,7 +290,7 @@ namespace bpkg
// with the thinking being that since the package is already in at
// least fetched state, we shouldn't be needing its location.
//
- std::vector<package_location> locations; //@@ Map?
+ vector<package_location> locations; //@@ Map?
// Package manifest data.
//
@@ -357,10 +353,10 @@ namespace bpkg
// (barely comprehensible) view/query to achieve this, doing it on
// the "client side" is definitely more straightforward.
//
- std::vector<shared_ptr<available_package>>
+ vector<shared_ptr<available_package>>
filter (const shared_ptr<repository>&, odb::result<available_package>&&);
- std::pair<shared_ptr<available_package>, shared_ptr<repository>>
+ pair<shared_ptr<available_package>, shared_ptr<repository>>
filter_one (const shared_ptr<repository>&, odb::result<available_package>&&);
// package_state
@@ -379,8 +375,8 @@ namespace bpkg
package_state
to_package_state (const string&); // May throw invalid_argument.
- inline std::ostream&
- operator<< (std::ostream& os, package_state s) {return os << to_string (s);}
+ inline ostream&
+ operator<< (ostream& os, package_state s) {return os << to_string (s);}
#pragma db map type(package_state) as(string) \
to(to_string (?)) \
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index 4113c12..a72ab21 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -5,8 +5,6 @@
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <stdexcept> // invalid_argument
-
#include <bpkg/database>
using namespace std;
diff --git a/bpkg/pkg-build b/bpkg/pkg-build
index a9ac4d3..566b456 100644
--- a/bpkg/pkg-build
+++ b/bpkg/pkg-build
@@ -6,6 +6,8 @@
#define BPKG_PKG_BUILD
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-build-options>
namespace bpkg
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 9c3914c..6138317 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -7,17 +7,11 @@
#include <map>
#include <set>
#include <list>
-#include <iterator> // make_move_iterator()
#include <iostream> // cout
#include <algorithm> // find()
-#include <functional> // reference_wrapper
-#include <butl/utility> // reverse_iterate()
-
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
#include <bpkg/satisfaction>
diff --git a/bpkg/pkg-clean b/bpkg/pkg-clean
index 73b21af..0bc5a60 100644
--- a/bpkg/pkg-clean
+++ b/bpkg/pkg-clean
@@ -6,6 +6,8 @@
#define BPKG_PKG_CLEAN
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-command>
#include <bpkg/pkg-clean-options>
diff --git a/bpkg/pkg-command b/bpkg/pkg-command
index 334a97e..6790917 100644
--- a/bpkg/pkg-command
+++ b/bpkg/pkg-command
@@ -6,9 +6,9 @@
#define BPKG_PKG_COMMAND
#include <bpkg/types>
+#include <bpkg/forward> // selected_package
#include <bpkg/utility>
-#include <bpkg/forward> // selected_package
#include <bpkg/configuration-options>
namespace bpkg
diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx
index 356d578..088ad9c 100644
--- a/bpkg/pkg-command.cxx
+++ b/bpkg/pkg-command.cxx
@@ -4,10 +4,8 @@
#include <bpkg/pkg-command>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/pkg-configure b/bpkg/pkg-configure
index 775f036..9b044e2 100644
--- a/bpkg/pkg-configure
+++ b/bpkg/pkg-configure
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // transaction, selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-configure-options>
namespace bpkg
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index 8cccddf..8a4fd5f 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -4,10 +4,8 @@
#include <bpkg/pkg-configure>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
#include <bpkg/satisfaction>
diff --git a/bpkg/pkg-disfigure b/bpkg/pkg-disfigure
index 239183d..f23bb87 100644
--- a/bpkg/pkg-disfigure
+++ b/bpkg/pkg-disfigure
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // transaction, selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-disfigure-options>
namespace bpkg
diff --git a/bpkg/pkg-disfigure.cxx b/bpkg/pkg-disfigure.cxx
index b16e837..5fa9990 100644
--- a/bpkg/pkg-disfigure.cxx
+++ b/bpkg/pkg-disfigure.cxx
@@ -4,10 +4,8 @@
#include <bpkg/pkg-disfigure>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/pkg-drop b/bpkg/pkg-drop
index 851ffbc..ea19e11 100644
--- a/bpkg/pkg-drop
+++ b/bpkg/pkg-drop
@@ -6,6 +6,8 @@
#define BPKG_PKG_DROP
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-drop-options>
namespace bpkg
diff --git a/bpkg/pkg-drop.cxx b/bpkg/pkg-drop.cxx
index 4331f3a..8c979d2 100644
--- a/bpkg/pkg-drop.cxx
+++ b/bpkg/pkg-drop.cxx
@@ -6,14 +6,10 @@
#include <map>
#include <list>
-#include <vector>
#include <iostream> // cout
-#include <functional> // reference_wrapper
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
#include <bpkg/satisfaction>
diff --git a/bpkg/pkg-fetch b/bpkg/pkg-fetch
index f35e1e8..bda8adf 100644
--- a/bpkg/pkg-fetch
+++ b/bpkg/pkg-fetch
@@ -9,6 +9,8 @@
#include <bpkg/types>
#include <bpkg/forward> // transaction, selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-fetch-options>
namespace bpkg
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index a57059d..f677deb 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -7,10 +7,8 @@
#include <bpkg/manifest>
#include <bpkg/fetch>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/checksum>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/pkg-install b/bpkg/pkg-install
index b934324..aafa367 100644
--- a/bpkg/pkg-install
+++ b/bpkg/pkg-install
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-command>
#include <bpkg/pkg-install-options>
diff --git a/bpkg/pkg-purge b/bpkg/pkg-purge
index e2389ce..6172e49 100644
--- a/bpkg/pkg-purge
+++ b/bpkg/pkg-purge
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // transaction, selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-purge-options>
namespace bpkg
diff --git a/bpkg/pkg-purge.cxx b/bpkg/pkg-purge.cxx
index dcaf2cd..62bf982 100644
--- a/bpkg/pkg-purge.cxx
+++ b/bpkg/pkg-purge.cxx
@@ -4,10 +4,8 @@
#include <bpkg/pkg-purge>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/pkg-status b/bpkg/pkg-status
index b585a13..b3eb637 100644
--- a/bpkg/pkg-status
+++ b/bpkg/pkg-status
@@ -6,6 +6,8 @@
#define BPKG_PKG_STATUS
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-status-options>
namespace bpkg
diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx
index 041da8c..a792e0c 100644
--- a/bpkg/pkg-status.cxx
+++ b/bpkg/pkg-status.cxx
@@ -5,12 +5,9 @@
#include <bpkg/pkg-status>
#include <iostream> // cout
-#include <functional> // function
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
#include <bpkg/manifest-utility>
diff --git a/bpkg/pkg-test b/bpkg/pkg-test
index cb42b14..252be03 100644
--- a/bpkg/pkg-test
+++ b/bpkg/pkg-test
@@ -6,6 +6,8 @@
#define BPKG_PKG_TEST
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-command>
#include <bpkg/pkg-test-options>
diff --git a/bpkg/pkg-uninstall b/bpkg/pkg-uninstall
index 77ed2f2..47b133d 100644
--- a/bpkg/pkg-uninstall
+++ b/bpkg/pkg-uninstall
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-command>
#include <bpkg/pkg-uninstall-options>
diff --git a/bpkg/pkg-unpack b/bpkg/pkg-unpack
index 62eaac4..748ce9c 100644
--- a/bpkg/pkg-unpack
+++ b/bpkg/pkg-unpack
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // transaction, selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-unpack-options>
namespace bpkg
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index caf5aa4..e3cc499 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -8,10 +8,8 @@
#include <bpkg/manifest>
-#include <bpkg/types>
#include <bpkg/package>
#include <bpkg/package-odb>
-#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
diff --git a/bpkg/pkg-update b/bpkg/pkg-update
index 59dde37..5cc28eb 100644
--- a/bpkg/pkg-update
+++ b/bpkg/pkg-update
@@ -7,6 +7,8 @@
#include <bpkg/types>
#include <bpkg/forward> // selected_package
+#include <bpkg/utility>
+
#include <bpkg/pkg-command>
#include <bpkg/pkg-update-options>
diff --git a/bpkg/pkg-verify b/bpkg/pkg-verify
index 3eccf66..2f21ea1 100644
--- a/bpkg/pkg-verify
+++ b/bpkg/pkg-verify
@@ -8,6 +8,8 @@
#include <bpkg/manifest>
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/pkg-verify-options>
namespace bpkg
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index a76370d..96caf28 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -11,8 +11,6 @@
#include <bpkg/manifest-parser>
-#include <bpkg/types>
-#include <bpkg/utility>
#include <bpkg/diagnostics>
using namespace std;
diff --git a/bpkg/rep-create b/bpkg/rep-create
index 3863d92..b215e1f 100644
--- a/bpkg/rep-create
+++ b/bpkg/rep-create
@@ -6,6 +6,8 @@
#define BPKG_REP_CREATE
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/rep-create-options>
namespace bpkg
diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx
index cc2ade1..8c6d3df 100644
--- a/bpkg/rep-create.cxx
+++ b/bpkg/rep-create.cxx
@@ -7,16 +7,12 @@
#include <map>
#include <fstream>
#include <iostream>
-#include <system_error>
#include <butl/filesystem> // dir_iterator
#include <bpkg/manifest>
#include <bpkg/manifest-serializer>
-#include <bpkg/types>
-#include <bpkg/utility>
-
#include <bpkg/checksum>
#include <bpkg/fetch>
#include <bpkg/diagnostics>
diff --git a/bpkg/rep-info b/bpkg/rep-info
index 85ac234..62c5121 100644
--- a/bpkg/rep-info
+++ b/bpkg/rep-info
@@ -6,6 +6,8 @@
#define BPKG_REP_INFO
#include <bpkg/types>
+#include <bpkg/utility>
+
#include <bpkg/rep-info-options>
namespace bpkg
diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx
index 241f04b..d2157af 100644
--- a/bpkg/rep-info.cxx
+++ b/bpkg/rep-info.cxx
@@ -5,14 +5,11 @@
#include <bpkg/rep-info>
#include <iostream> // cout
-#include <stdexcept> // invalid_argument
#include <bpkg/manifest>
#include <bpkg/manifest-serializer>
#include <bpkg/fetch>
-#include <bpkg/types>
-#include <bpkg/utility>
#include <bpkg/diagnostics>
#include <bpkg/manifest-utility>
diff --git a/bpkg/satisfaction b/bpkg/satisfaction
index e4f3495..a140b5f 100644
--- a/bpkg/satisfaction
+++ b/bpkg/satisfaction
@@ -6,9 +6,10 @@
#define BPKG_SATISFACTION
#include <bpkg/types>
-#include <bpkg/package>
#include <bpkg/utility>
+#include <bpkg/package>
+
namespace bpkg
{
// Return true if version satisfies the constraint.
diff --git a/bpkg/types b/bpkg/types
index b0db478..aa88701 100644
--- a/bpkg/types
+++ b/bpkg/types
@@ -7,11 +7,17 @@
#include <vector>
#include <string>
-#include <memory> // shared_ptr, unique_ptr
-#include <cstddef> // size_t
-#include <cstdint> // uint{8,16,32,64}_t
+#include <memory> // unique_ptr, shared_ptr
+#include <utility> // pair
+#include <cstddef> // size_t, nullptr_t
+#include <cstdint> // uint{8,16,32,64}_t
#include <istream>
#include <ostream>
+#include <functional> // function, reference_wrapper
+
+#include <exception> // exception
+#include <stdexcept> // logic_error, invalid_argument, runtime_error
+#include <system_error>
#include <odb/lazy-ptr.hxx>
@@ -26,8 +32,18 @@ namespace bpkg
using std::uint16_t;
using std::uint32_t;
using std::uint64_t;
+
using std::size_t;
+ using std::nullptr_t;
+
+ using std::pair;
using std::string;
+ using std::function;
+ using std::reference_wrapper;
+
+ using std::unique_ptr;
+ using std::shared_ptr;
+ using std::weak_ptr;
using std::vector;
@@ -37,16 +53,21 @@ namespace bpkg
using std::istream;
using std::ostream;
+ // Exceptions. While <exception> is included, there is no using for
+ // std::exception -- use qualified.
+ //
+ using std::logic_error;
+ using std::invalid_argument;
+ using std::runtime_error;
+ using std::system_error;
+
+ // <butl/optional>
+ //
using butl::optional;
using butl::nullopt;
- // Smart pointers
+ // ODB smart pointers.
//
- using std::unique_ptr;
-
- using std::shared_ptr;
- using std::weak_ptr;
-
using odb::lazy_shared_ptr;
using odb::lazy_weak_ptr;
@@ -60,6 +81,8 @@ namespace bpkg
using paths = std::vector<path>;
using dir_paths = std::vector<dir_path>;
+ // Custom path printing.
+ //
inline ostream&
operator<< (ostream& os, const path& p) {return os << p.string ();}
diff --git a/bpkg/utility b/bpkg/utility
index 9aa2dba..3b2a11f 100644
--- a/bpkg/utility
+++ b/bpkg/utility
@@ -5,9 +5,14 @@
#ifndef BPKG_UTILITY
#define BPKG_UTILITY
-#include <memory> // make_shared()
-#include <cassert>
-#include <utility> // move()
+#include <memory> // make_shared()
+#include <string> // to_string()
+#include <utility> // move(), forward(), declval(), make_pair()
+#include <cassert> // assert()
+#include <iterator> // make_move_iterator()
+
+#include <butl/utility> // reverse_iterate()
+
#include <exception> // uncaught_exception()
#include <butl/filesystem>
@@ -17,8 +22,17 @@
namespace bpkg
{
using std::move;
+ using std::forward;
+ using std::declval;
+
+ using std::make_pair;
using std::make_shared;
- using std::to_string; // To complement bpkg::to_string().
+ using std::make_move_iterator;
+ using std::to_string;
+
+ // <butl/utility>
+ //
+ using butl::reverse_iterate;
// Y/N prompt. The def argument, if specified, should be either 'y'
// or 'no'. It is used as the default answer, in case the user just
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index 556bc88..f6cbc45 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -4,14 +4,11 @@
#include <bpkg/utility>
-#include <iostream> // cout cin
-#include <system_error>
+#include <iostream> // cout, cin
#include <butl/process>
-#include <bpkg/types>
#include <bpkg/diagnostics>
-
#include <bpkg/common-options>
using namespace std;