45 Commits

Author SHA1 Message Date
Rene Rivera
dc8e70a190 Update build deps. 2024-08-07 23:48:42 -05:00
Rene Rivera
8e982da288 Change all <source> references to <library>. 2024-07-20 19:42:32 -05:00
Rene Rivera
9ca6bab033 Make the library modular usable. 2024-03-11 08:38:17 -05:00
hgkjshegfskef
13ca3d6dd3 fix safe_format includes (#114)
std::numeric_limits requires <limits>

Co-authored-by: hgkjshegfskef <hgkjshegfskef@protonmail.com>
2022-06-06 18:22:59 -07:00
Robert Ramey
0eaf4c8149 fix issues and PRs 2021-05-23 15:56:56 -07:00
Robert Ramey
bb216bf58e updates to support better concepts 2021-05-11 11:14:49 -07:00
Robert Ramey
ac0d4ec85b eliminate bogus compile time warning from gcc on assignment to smaller integer 2020-12-28 16:10:27 -08:00
Robert Ramey
dea5a291b1 Added “inline” to all free standing functions. This is in response to an issue whereby including the same types in a library ends up producing multiple copies of the function. This only shows up when combinations of types are reused. This should fix the problem. BUT I can’t figure out a way to really test it. These changes pass all tests - but there is no “linking” test to show this specific problem.
Actually this raises the question about what a “header only” library really is.  When it gets included in multiple modules, it looks like the compiler/linker consolidates functions with the same type signature - thus conflicting with most persons idea of what “header only” should actually mean.  Food for thought.

It also raises the issue of “head only” libraries and “code bloat”.  By making sure everything is inline we are contributing to code bloat.  This really should/could be addressed with making “inline”  INLINE and defining it according to what kind output we want to produce (ie. executable, static library, shared library, etc.).  But of course that changes the API - another can of worms.
2020-12-15 11:04:31 -08:00
Robert Ramey
cbb4197a17 cleaned up definitions for constructors and casting operators
passes all tests and examples.
minor documentation fixes
2020-11-07 07:09:37 -08:00
Robert Ramey
c4b0d5fbb6 simplified safe<T> <-> T conversions.
fails test_rational only
2020-11-02 07:23:04 -08:00
Giovanni Mascellani
ec2eb0fdcb Fix typo in copyright headers. (#85) 2020-10-14 05:13:36 -07:00
Robert Ramey
9a765f565c cleaned up issues in type requirement issues for integer only operations. 2020-01-20 15:26:50 -08:00
Robert Ramey
d692eddd3d test all examples 2019-12-15 08:47:44 -08:00
Robert Ramey
3e83dc88ce fix examples so they can run without console input 2019-12-14 23:05:28 -08:00
Robert Ramey
4a7acbf040 recent changes provoked error in example93. Very interesting as this example was used as a “provably” correct stepper motor implementation in CPPCon 2018. Fixing this led to some changes in casting of checked numbers. Currently passing all tests/examples on my machine. 2019-12-13 16:40:57 -08:00
Andrey Semashev
9b4408a5ac Fix ends of lines, remove executable permission (#72)
* Converted Windows ends of line to UNIX.

Text files in git must have UNIX ends of lines, to be converted to Windows
EOLs on checkout, as required by git settings on the user's system.

* Removed executable permission from header.
2019-06-23 12:12:57 -07:00
Robert Ramey
58db776217 ixed issue related to lack of constexpr in exception with an “inline”
miscellaneous improvements in documentation
improved CMake implementation
2019-05-03 14:03:51 -07:00
Robert Ramey
dec518c4a9 Fixed Exception Policies for trap and ignore. 2019-02-24 09:54:13 -08:00
Robert Ramey
f49e434238 Add tests for constexpr
improved CMake implementation for testing and development
2019-01-10 11:54:18 -08:00
Robert Ramey
a06d9f7a69 added constexpr tests to checked result operations
added tests for check result < and == operations
correct implementation of some checked result types
added constexpr example
2018-12-10 14:12:47 -08:00
Robert Ramey
899e5c1b48 removed dependency on boost preprocessor
removed last dependency on boost mpl
2018-11-23 15:40:44 -08:00
Robert Ramey
1bdf30e2b2 clean up exception catching to suppress warnings.
sync up class and struct
2018-09-30 17:39:33 -07:00
Robert Ramey
992bd7b311 Changes generated by preparation for CPPCon 2018 2018-09-15 10:48:41 -07:00
Robert Ramey
52e0a2fe03 correction to exception expected
add example8 for difference between two unsigned ints
update documentation - pending issues
2018-09-04 13:37:21 -07:00
Robert Ramey
37457049a3 upgrades in documentation 2018-09-02 11:05:08 -07:00
Robert Ramey
0e25e2095b alter directory structure to comply with boost requirements 2018-08-16 11:03:38 -07:00
Robert Ramey
e68037cb32 Update documentation to address PRs
update appveyor/travis xml hoping they'll work
2018-08-14 16:46:19 -07:00
Robert Ramey
4e63548736 Refine embedded case study after running code on MPLab simulator 2018-08-10 13:07:38 -07:00
Robert Ramey
ffe8c9eaa2 add missing html files for case study
fix issue with CMakeLists.txt
2018-08-02 08:05:23 -07:00
Robert Ramey
88519fbcdc forgot to include new files motor_test1.c, motor_test2.c, motor_test3.c 2018-07-21 09:59:33 -07:00
Robert Ramey
b62ef86e28 Added case study for embedded system
corrections in cpp promotion
added make_safe_literal
separated integers from other types
dropped example91
updated CMakeLists.txt and Jamfile.v2 accordingly
2018-07-21 09:57:35 -07:00
Robert Ramey
53bd56c597 improved support for constexpr
improved support for safe_literals
corrected errors in less_than and equal which were failing to detect possible runtime failures.
simplified pseudo partial specialization for checked_result_operations
2018-05-19 15:59:28 -07:00
Robert Ramey
ff130138ca update Jamfile to address CI problem 2018-04-24 14:33:17 -07:00
Robert Ramey
0d443e3a6f alterations to accomodate VS 2017
currently passes all tests and examples on Clang, gcc and mdvc with C++14
2018-04-23 10:22:34 -07:00
Robert Ramey
b534437b76 correct issues in example93 and misc gcc issues.
correct Jamfile to skip performance test in debug mode
implement compile only test in CMakeLists.txt
2018-04-07 15:30:02 -07:00
Robert Ramey
325de8e171 corrected bugs detected after rebasing to devlop 2018-03-26 12:16:25 -07:00
Robert Ramey
99ee93d94d refactored checked operations, added corresponding tests and documentation
meant to improve correctness and extendability.
2018-03-24 18:22:48 -07:00
Robert Ramey
1490e9fe57 refactored to implement checked_result arithmetic - still some tests to fix 2018-03-13 15:04:16 -07:00
Robert Ramey
4153b7f58a Numerous changes to better handle floating point.
Turns out that these changes should also better position us to handle other underlying types - but we're not there yet.
Added example for composition with other types - example boost rational and boost multi precision
Added performance test using boost multi precision
Many other small corrections
2017-07-16 13:36:09 -07:00
Robert Ramey
86910466a8 Intermediate working version
Making way for checked_float, checked_money, etc

a) factoring checked into checked_integer etc.
b) moved some tests from test_z to official tests
c) added test_rational which tests interoperability with boost::rational
d) moved safe_range to safe_integer_range
2017-07-08 12:48:37 -07:00
Robert Ramey
67bc38ac62 added example based on rational.hpp
used enable_if on checked functions to pave the way for other checked implementations
2017-06-27 22:56:11 -07:00
Robert Ramey
6854782928 reversed decision to make casting explicit. It's implicit again. Making it explicit didn't solve any issues but caused a number of examples to fail requiring an explanation. Now It's back to the way it was. 2017-06-25 21:19:58 -07:00
Robert Ramey
39e8c30097 used enable if on constructor so that it only gets instantiated when passed an integer type.
before this change, it would get instantiated by is_convertible<T, safe<U>> for any type T which created a syntax error.
This problem appears with using rational<safe<int>> but passes tests now.
Switched casting operators back to implicit.  Having it explicit makes it safe types more unwieldy to use and breaks some examples.
2017-06-25 11:46:11 -07:00
Robert Ramey
a1ea2eda24 eliminated implicit conversion from safe type to any other type.
updated documentation accordingly
2017-06-23 22:13:44 -07:00
Robert Ramey
3d67f22735 made fixes to pass tests for GCC compilers.
made jam files to be compatible with boost
made version of apveyor.yml which might work
2017-06-14 12:25:07 -07:00