mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
17 lines
304 B
C++
17 lines
304 B
C++
|
#pragma once
|
||
|
|
||
|
#include "store-api.hh"
|
||
|
|
||
|
namespace nix {
|
||
|
|
||
|
template<typename T>
|
||
|
T & require(Store & store)
|
||
|
{
|
||
|
auto * castedStore = dynamic_cast<T *>(&store);
|
||
|
if (!castedStore)
|
||
|
throw UsageError("%s not supported by store '%s'", T::operationName, store.getUri());
|
||
|
return *castedStore;
|
||
|
}
|
||
|
|
||
|
}
|