-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
enhancementNew feature or requestNew feature or request
Description
E.g., imagine that you want to disallow an ArrayNode from ever being dynamic. It might be nice to be able to specify that as a template argument to ArrayOutputMixin. This would allow is to combine different flags like the one we already added to ScalarOutputMixin in #271.
Something like
enum class ArrayMixinFlags {
// default is sometimes dynamic
AlwaysDynamic = 1 << 0,
NeverDynamic = 1 << 1,
// default is not to provide a state implementation
ProvideState = 1 << 2,
};
template <class Base, ArrayMixinFlags Flags = 0>
class ArrayOutputMixin : public Base {
template <std::ranges::sized_range Range>
explicit ArrayOutputMixin(Range&& shape)
: ndim_(shape.size()), shape_(make_shape(std::forward<Range>(shape))) {
if constexpr (Flags && ArrayMixinFlags::NeverDynamic) {
// throw an error if dynamic
}
}
...
};
class NeverDynamicNode : public ArrayOutputMixin<ArrayNode, ArrayMixinFlags::NeverDynamic> {
...
};
class NeverDynamicAndDefaultStateNode : public ArrayOutputMixin<ArrayNode, ArrayMixinFlags::NeverDynamic | ArrayMixinFlags::ProvideState> {
...
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request