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/libstore/worker-protocol.hh | |
parent | 6c66331d5c34d97092a9b5e2832fed73e0da3c87 (diff) |
Solve template deduction problem
We had to predeclare our template functions
Diffstat (limited to 'src/libstore/worker-protocol.hh')
-rw-r--r-- | src/libstore/worker-protocol.hh | 16 |
1 files changed, 13 insertions, 3 deletions
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); } |