math: Breakup require_generics.hpp into multiple files
Description
After looking at require_generics.hpp it’s too big and confusing imo. What I’d like to do is take all the stuff in there, break it up so that require_generics.hpp is just the definitions for the different base requires_*, then move the specializations over to each folder the is_* typedef is associated with.
Example
is_var.hpp would look like
//...
#include <stan/math/prim/meta/require.hpp>
//...
/** \ingroup type_trait
* Defines a static member named value which is defined to be false
* as the primitive scalar types cannot be a stan::math::var type.
*/
template <typename T, typename = void>
struct is_var : std::false_type {};
template <typename T>
using require_var_t = require_t<is_var<std::decay_t<T>>>;
template <typename T>
using require_not_var_t = require_not_t<is_var<std::decay_t<T>>>;
template <typename... Types>
using require_all_var_t = require_all_t<is_var<std::decay_t<Types>>...>;
template <typename... Types>
using require_any_var_t = require_any_t<is_var<std::decay_t<Types>>...>;
template <typename... Types>
using require_all_not_var_t = require_all_not_t<is_var<std::decay_t<Types>>...>;
template <typename... Types>
using require_any_not_var_t = require_any_not_t<is_var<std::decay_t<Types>>...>;
Current Version:
v3.1.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (8 by maintainers)
While you are at this, can you also add some requires for differentiating between sparse and dense matrices?