我正在努力解决以下问题。
我有一个名为FilteredCollection
的类,它有两个通用参数。
CollectionSourceModel
CollectionFilterObject
CollectionFilterObject
还需要一个等于CollectionSourceModel
的通用参数。这看起来像以下代码段:
class FilteredCollection
<
CollectionSourceModel: CollectionItem,
CollectionFilterObject: CollectionFilter<CollectionSourceModel>
>:
Collection<CollectionSourceModel>,
CollectionFilterDelegate
{
let filterHandler: CollectionFilterObject
}
并允许我创建如下的子类:
class TheatreFilter: CollectionFilter<TheatreItem>
{
// some filter stuff
}
class TheatreCollection: FilteredCollection<TheatreItem, TheatreFilter>
{
// some collection operations
}
这不会在代码中显示错误,但会给我留下编译错误:
Command failed due to signal: Segmentation fault: 11
我的模式是否有更好的解决方法?