Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
RoutingMap.h
Go to the documentation of this file.
1#pragma once
2#include <type_traits>
3#include <utility>
4#include <vector>
5
7{
8// Keep Maestro buildable with older QCSim releases. Without an authoritative
9// map, use the native local optimizer instead of a possibly stale mirror.
10template <class T, class = void> struct HasRoutingMap : std::false_type
11{
12};
13
14template <class T> struct HasRoutingMap<T, std::void_t<decltype(std::declval<const T &>().getQubitsMap())>> : std::true_type
15{
16};
17
18template <class T> std::vector<long long> ReadRoutingMap(const T *simulator)
19{
20 if constexpr (HasRoutingMap<T>::value)
21 {
22 if (simulator)
23 {
24 const auto &map = simulator->getQubitsMap();
25 return {map.begin(), map.end()};
26 }
27 }
28 return {};
29}
30} // namespace Simulators::Private
std::vector< long long > ReadRoutingMap(const T *simulator)
Definition RoutingMap.h:18