AIToolbox
A library that offers tools for AI problem solving.
Types.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_POMDP_UTILS_TYPES_HEADER_FILE
2 #define AI_TOOLBOX_POMDP_UTILS_TYPES_HEADER_FILE
3 
4 #include <optional>
7 
8 namespace AIToolbox::POMDP {
14  template <typename LP>
15  struct is_witness_lp {
16  private:
17  template <typename Z> static auto test(int) -> decltype(
18 
19  Z(0), // Check we can build it from a size_t
20  static_cast<void (Z::*)()> (&Z::reset),
21  static_cast<void (Z::*)(size_t size)> (&Z::allocate),
22  static_cast<void (Z::*)(const MDP::Values &)> (&Z::addOptimalRow),
23  static_cast<std::optional<Belief> (Z::*)(const MDP::Values &)> (&Z::findWitness),
24 
25  std::true_type()
26  );
27 
28  template <typename Z> static auto test(...) -> std::false_type;
29 
30  public:
31  enum { value = std::is_same_v<decltype(test<LP>(0)),std::true_type> };
32  };
33  template <typename LP>
34  inline constexpr bool is_witness_lp_v = is_witness_lp<LP>::value;
35 }
36 
37 #endif
AIToolbox::POMDP
Definition: AMDP.hpp:14
AIToolbox::POMDP::is_witness_lp_v
constexpr bool is_witness_lp_v
Definition: Types.hpp:34
TypeTraits.hpp
AIToolbox::POMDP::is_witness_lp::value
@ value
Definition: Types.hpp:31
AIToolbox::MDP::Values
Vector Values
Definition: Types.hpp:44
AIToolbox::POMDP::is_witness_lp
This check the interface for a WitnessLP.
Definition: Types.hpp:15
Types.hpp