Design Notes

| Home | Libraries | People | FAQ | More

## Design Notes

> "The art of simplicity is a puzzle of complexity” Doug Horton

Feel free to skip this section. It is here to document the process and the decisions made during design to be able to review and to reevaluate and to ensure the relevancy and the correctness of those decisions and ultimately the design. Still, this section might be useful for understanding why and how certain decisions have been made and why Boost.Convert is the way it is.

### Requirements

Boost.Convert has been designed to satisfy the following user requirements:

1. (R1) Boost.Convert shall provide a mechanism and an interface that take a value of type TypeIn and yield a value of type TypeOut using an algorithm of type Converter;
2. (R2) Boost.Convert shall provide a mechanism and an interface to indicate success or failure of the requested conversion;
3. (R3) Boost.Convert shall provide fully-functional interfaces for two different program flows where
   1. (R3a) error-processing is orthogonal to the normal program flow (exception-throwing interface);
   2. (R3b) normal and error-processing flows are part of the same program flow (non-throwing interface);
4. (R4) The throwing interface shall return the result of successful conversion or shall throw an exception;
5. (R5) The non-throwing interface shall return the result and/or some indication of conversion success or failure;
   1. (R5a) there shall be means to distinguish success from failure;
   2. (R5b) the result of conversion shall only be available when conversion succeeds;
   3. (R5c) when conversion fails, an optional fallback value shall be returned instead if supplied;
   4. (R5d) in the case of failure (with no fallback provided) an attempt to retrieve the result shall result in an exception thrown;
6. (R6) Boost.Convert shall provide a uniform interface suitable for generic programming;
7. (R7) Boost.Convert shall not interfere with or intercept any exceptions that are not part of the official converter interface (i.e. exceptions caused by malfunction, etc.);
8. (R8) Converters shall be independent of and shall not rely on the Boost.Convert infrastructure.