From 0337f5f7fbdaa05d5cf79c32bfbd0ded47514afd Mon Sep 17 00:00:00 2001 From: conrad Date: Mon, 19 Dec 2022 14:51:44 +1000 Subject: [PATCH] declare options as constexp --- include/armadillo_bits/gmm_misc_bones.hpp | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/include/armadillo_bits/gmm_misc_bones.hpp b/include/armadillo_bits/gmm_misc_bones.hpp index 104a7c29..44507d41 100644 --- a/include/armadillo_bits/gmm_misc_bones.hpp +++ b/include/armadillo_bits/gmm_misc_bones.hpp @@ -20,37 +20,37 @@ //! @{ -struct gmm_dist_mode { const uword id; inline explicit gmm_dist_mode(const uword in_id) : id(in_id) {} }; +struct gmm_dist_mode { const uword id; inline constexpr explicit gmm_dist_mode(const uword in_id) : id(in_id) {} }; inline bool operator==(const gmm_dist_mode& a, const gmm_dist_mode& b) { return (a.id == b.id); } inline bool operator!=(const gmm_dist_mode& a, const gmm_dist_mode& b) { return (a.id != b.id); } -struct gmm_dist_eucl : public gmm_dist_mode { inline gmm_dist_eucl() : gmm_dist_mode(1) {} }; -struct gmm_dist_maha : public gmm_dist_mode { inline gmm_dist_maha() : gmm_dist_mode(2) {} }; -struct gmm_dist_prob : public gmm_dist_mode { inline gmm_dist_prob() : gmm_dist_mode(3) {} }; +struct gmm_dist_eucl : public gmm_dist_mode { inline constexpr gmm_dist_eucl() : gmm_dist_mode(1) {} }; +struct gmm_dist_maha : public gmm_dist_mode { inline constexpr gmm_dist_maha() : gmm_dist_mode(2) {} }; +struct gmm_dist_prob : public gmm_dist_mode { inline constexpr gmm_dist_prob() : gmm_dist_mode(3) {} }; -static const gmm_dist_eucl eucl_dist; -static const gmm_dist_maha maha_dist; -static const gmm_dist_prob prob_dist; +static constexpr gmm_dist_eucl eucl_dist; +static constexpr gmm_dist_maha maha_dist; +static constexpr gmm_dist_prob prob_dist; -struct gmm_seed_mode { const uword id; inline explicit gmm_seed_mode(const uword in_id) : id(in_id) {} }; +struct gmm_seed_mode { const uword id; inline constexpr explicit gmm_seed_mode(const uword in_id) : id(in_id) {} }; inline bool operator==(const gmm_seed_mode& a, const gmm_seed_mode& b) { return (a.id == b.id); } inline bool operator!=(const gmm_seed_mode& a, const gmm_seed_mode& b) { return (a.id != b.id); } -struct gmm_seed_keep_existing : public gmm_seed_mode { inline gmm_seed_keep_existing() : gmm_seed_mode(1) {} }; -struct gmm_seed_static_subset : public gmm_seed_mode { inline gmm_seed_static_subset() : gmm_seed_mode(2) {} }; -struct gmm_seed_static_spread : public gmm_seed_mode { inline gmm_seed_static_spread() : gmm_seed_mode(3) {} }; -struct gmm_seed_random_subset : public gmm_seed_mode { inline gmm_seed_random_subset() : gmm_seed_mode(4) {} }; -struct gmm_seed_random_spread : public gmm_seed_mode { inline gmm_seed_random_spread() : gmm_seed_mode(5) {} }; +struct gmm_seed_keep_existing : public gmm_seed_mode { inline constexpr gmm_seed_keep_existing() : gmm_seed_mode(1) {} }; +struct gmm_seed_static_subset : public gmm_seed_mode { inline constexpr gmm_seed_static_subset() : gmm_seed_mode(2) {} }; +struct gmm_seed_static_spread : public gmm_seed_mode { inline constexpr gmm_seed_static_spread() : gmm_seed_mode(3) {} }; +struct gmm_seed_random_subset : public gmm_seed_mode { inline constexpr gmm_seed_random_subset() : gmm_seed_mode(4) {} }; +struct gmm_seed_random_spread : public gmm_seed_mode { inline constexpr gmm_seed_random_spread() : gmm_seed_mode(5) {} }; -static const gmm_seed_keep_existing keep_existing; -static const gmm_seed_static_subset static_subset; -static const gmm_seed_static_spread static_spread; -static const gmm_seed_random_subset random_subset; -static const gmm_seed_random_spread random_spread; +static constexpr gmm_seed_keep_existing keep_existing; +static constexpr gmm_seed_static_subset static_subset; +static constexpr gmm_seed_static_spread static_spread; +static constexpr gmm_seed_random_subset random_subset; +static constexpr gmm_seed_random_spread random_spread; namespace gmm_priv