autoppl  v0.8
A C++ template library for probabilistic programming
model_expr_traits.hpp
Go to the documentation of this file.
1 #pragma once
2 #if __cplusplus <= 201703L
4 #else
5 #include <concepts>
6 #endif
8 
9 namespace ppl {
10 namespace util {
11 
17 template <class T>
19 { using BaseCRTP<T>::self; };
20 
24 template <class T>
25 inline constexpr bool model_expr_is_base_of_v =
26  std::is_base_of_v<ModelExprBase<T>, T>;
27 
28 template <class T>
30 {
31  using dist_value_t = typename T::dist_value_t;
32 };
33 
34 #if __cplusplus <= 201703L
35 
36 template <class T>
37 inline constexpr bool is_model_expr_v =
38  model_expr_is_base_of_v<T> &&
39  has_type_dist_value_t_v<T>
40  ;
41 
42 #else
43 
44 template <class T>
45 concept model_expr_c =
46  model_expr_is_base_of_v<T> &&
47  requires (const T& cx) {
51  }
52  ;
53 
54 template <class T>
55 concept is_model_expr_v = model_expr_c<T>;
56 
57 #endif
58 
59 } // namespace util
60 } // namespace ppl
ppl::util::ModelExprBase
Definition: model_expr_traits.hpp:19
ppl::util::model_expr_traits
Definition: model_expr_traits.hpp:30
ppl::util::is_model_expr_v
constexpr bool is_model_expr_v
Definition: model_expr_traits.hpp:37
type_traits.hpp
ppl::util::model_expr_is_base_of_v
constexpr bool model_expr_is_base_of_v
Definition: model_expr_traits.hpp:25
ppl::util::BaseCRTP
Definition: type_traits.hpp:65
ppl::math::dist_value_t
util::dist_value_t dist_value_t
Definition: density.hpp:16
ppl
Definition: bounded.hpp:11
ppl::util::model_expr_traits::dist_value_t
typename T::dist_value_t dist_value_t
Definition: model_expr_traits.hpp:31
concept.hpp