Solve template deduction problem

We had to predeclare our template functions
This commit is contained in:
Carlo Nucera 2020-08-05 17:49:45 -04:00
parent 6c66331d5c
commit 0739d428e0
2 changed files with 14 additions and 4 deletions

View file

@ -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;
}

View file

@ -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);
}