Click Here

I've started working on a basic template class that can help automate range checking in specialized numeric types. My inspiration for this comes from the ranged types found in languages like Pascal and Ada. Currently, the focus is on integer types, but I've designed it to be adaptable for floating-point types as well (although I may need to revisit this aspect later on).

While it's still in the early stages, this template class aims to simplify the definition of numeric types that don't fit the typical signed and unsigned sizes of 8/16/32/64 bits. It allows the client-programmer to choose a base type, set lower and upper bounds, and define how the class should handle underflow or overflow situations. The available options currently include wrapping around, saturating at the boundary, or throwing an exception. Additionally, all the standard arithmetic operators will be supported.

Now, here's my question: Do you believe this class would be genuinely useful to write, and do you think others would find it valuable enough to warrant making it publicly available? Can you envision any practical scenarios where this class would simplify the development of real-world projects for other programmers?

Recommended Answers

All 2 Replies

Please show us what you have in your code, quite difficult to say based on your description.

It's really difficult to understand.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.