Menu

#27 Add inequality and range constraints

Unknown
open
nobody
None
5
2025-06-17
2025-06-13
No

As far as I can tell, currently only equality constraints are supported, eg. here is a list of values that are supported. This is fine, but cannot express things like "this must be positive" or "this must be between -1 and 9". For these, inequality and range constraints would need to be implemented.

Discussion

  • Mike Smoot

    Mike Smoot - 2025-06-14

    Can't you do this with the Constraint class: https://tclap.sourceforge.net/manual.html#CONSTRAINT? Do you need something different than this?

     
  • Tibor Győri

    Tibor Győri - 2025-06-14

    I guess I should have RTFM with more attention, because yes, that would work. I was searching the doxygen docs for something other than ValuesConstraint and couldn't find any.
    Still, I think that inequality and range constraints are both simple and common enough that it would be useful to have them ready-made, instead of asking the users to implement them themselves.

     
  • Daniel Aarno

    Daniel Aarno - 2025-06-17

    Patches against 1.4 are welcome.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.