There are several concept archetypes available:
#include <boost/concepts/std_real_concept.hpp>
namespace boost{ namespace math{ namespace concepts{ class std_real_concept; }}} // namespaces
The main purpose in providing this type is to verify that standard library functions are found via a using declaration - bringing those functions into the current scope - and not just because they happen to be in global scope.
In order to ensure that a call to say For example if the code calls ::pow rather than std::pow, the code will cleanly compile, but truncation of long doubles to double will cause a significant loss of precision. In contrast a template instantiated with std_real_concept will only compile if the all the standard library functions used have been brought into the current scope with a using declaration.
There is a test program libs/math/test/std_real_concept_check.cpp
that instantiates every template in this library with type
#include <boost/math/concepts/real_concept.hpp>
namespace boost{ namespace math{ namespace concepts{ class real_concept; }}} // namespaces
NTL RR is an example of a type meeting the requirements that this type models, but note that use of a thin wrapper class is required: refer to "Using With NTL - a High-Precision Floating-Point Library".
There is no specific test case for type
#include <boost/math/concepts/distribution.hpp>
namespace boost{ namespace math{ namespace concepts{ template <class RealType> class distribution_archetype; template <class Distribution> struct DistributionConcept; }}} // namespaces
The class template
The class template
The test program distribution_concept_check.cpp
is responsible for using
The class template v = pdf(dist, x); // (Result v is ignored). And in addition, those that accept two arguments do the right thing when the arguments are of different types (the result type is always the same as the distribution's value_type). (This is implemented by some additional forwarding-functions in derived_accessors.hpp, so that there is no need for any code changes. Likewise boilerplate versions of the hazard/chf/coefficient_of_variation functions are implemented in there too.) |