diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-08-05 17:49:45 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-08-05 17:49:45 -0400 |
commit | 0739d428e07b59b7d44bdbf7354dafaae09dba7c (patch) | |
tree | 120cb5d1b6a69e4e3b1125b1f326c42082114eb6 /src | |
parent | 6c66331d5c34d97092a9b5e2832fed73e0da3c87 (diff) |
Solve template deduction problem
We had to predeclare our template functions
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/daemon.cc | 2 | ||||
-rw-r--r-- | src/libstore/worker-protocol.hh | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index e18f793c8..a420dcab0 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -327,7 +327,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, logger->startWork(); auto outputs = store->queryDerivationOutputMap(path); logger->stopWork(); - write(*store, to, outputs); + nix::worker_proto::write(*store, to, outputs); break; } diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index fdd700668..c50995d7c 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -78,6 +78,19 @@ struct Phantom {}; namespace worker_proto { /* FIXME maybe move more stuff inside here */ +StorePath read(const Store & store, Source & from, Phantom<StorePath> _); +void write(const Store & store, Sink & out, const StorePath & storePath); + +template<typename T> +std::map<std::string, T> read(const Store & store, Source & from, Phantom<std::map<std::string, T>> _); +template<typename T> +void write(const Store & store, Sink & out, const std::map<string, T> & resMap); +template<typename T> +std::optional<T> read(const Store & store, Source & from, Phantom<std::optional<T>> _); +template<typename T> +void write(const Store & store, Sink & out, const std::optional<T> & optVal); + + template<typename T> std::map<std::string, T> read(const Store & store, Source & from, Phantom<std::map<std::string, T>> _) { @@ -122,9 +135,6 @@ void write(const Store & store, Sink & out, const std::optional<T> & optVal) nix::worker_proto::write(store, out, *optVal); } -StorePath read(const Store & store, Source & from, Phantom<StorePath> _); - -void write(const Store & store, Sink & out, const StorePath & storePath); } |