You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
The class QuantumProcessorDispatcher does not constrain the type of its quantum processor beyond IQuantumProcessor, such that subclasses of the QuantumProcessorDispatcher class cannot rely on being given a specific subtype of IQuantumProcessor. This in turn causes a reliance on unsafe runtime casting.
publicpartialclassQpicSimulator:QuantumProcessorDispatcher{publicQpicSimulator():base(newQpicProcessor()){}// Implementation of the `Barrier` operation for the QpicSimulatorpublicclassBarrierImpl:Barrier{privateQpicProcessorprocessor;publicBarrierImpl(QpicSimulatorm):base(m){// The type of the QuantumProcessor processor isn't known precisely here, requiring a cast.processor=(QpicProcessor)m.QuantumProcessor;}}}
Proposed solution
Introduce a new class QuantumProcessorDisatcher<T> where T : IQuantumProcessor so that the exact type of QuanutmProcessorDispatcher<T>.QuantumProcessor can be expressed as T. This can be made as a non-breaking change by having QuanutmProcessorDispatcher inherit from QuantumProcessorDispatcher<IQuantumProcessor>.