Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to define limits for attribute<numbers> #197

Open
isabelgk opened this issue Jan 11, 2023 · 0 comments
Open

Add ability to define limits for attribute<numbers> #197

isabelgk opened this issue Jan 11, 2023 · 0 comments
Assignees

Comments

@isabelgk
Copy link
Contributor

Currently, it's not possible to define attribute<numbers> with a limit. It'd be nice to be able to do something like:

attribute<numbers, threadsafe::no, limit::clamp> m_foo { this, "foo", { 0.0, 0.0 },
    range { {-1.0, 3.5}, {-4.3, 7.0} }
};

This fails because:

error: no matching constructor for initialization of 'c74::min::range' (aka 'vector<c74::min::atom>')
    range { {-1.0, 3.5}, {-4.3, 7.0} }
    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c74_min_attribute.h:758:13: error: static_assert failed due to requirement 'std::is_arithmetic<std::vector<double, std::allocator<double>>>::value' "limiting can only be applied to arithmetic types"
                   static_assert(std::is_arithmetic<T>::value, "limiting can only be applied to arithmetic types");
                   ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We'd need to:

  • be able to construct a c74::min::range of numbers
  • have a specialization of the constrain method for vectors of numeric types
@isabelgk isabelgk self-assigned this Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant