在我的C ++ / WinRT项目中,我尝试使用在此处创建的示例矢量:https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/collections
struct MyObservableVector :
implements<MyObservableVector, IObservableVector<float>, IVector<float>, IVectorView<float>, IIterable<float>>,
winrt::observable_vector_base<MyObservableVector, float>
{
auto& get_container() const noexcept
{
return m_values;
}
auto& get_container() noexcept
{
return m_values;
}
private:
std::vector<float> m_values{ 0.1f, 0.2f, 0.3f };
};
例如,有人将如何在PhotoEditor
演示应用程序中使用此向量? (https://github.com/Microsoft/Windows-appsample-photo-editor)
假设您要将其声明为Photo.idl
Photo.h
Photo.cpp
ViewModel的一部分?