Skip to content
Snippets Groups Projects
Unverified Commit 87a8f81a authored by Joris Vaillant's avatar Joris Vaillant
Browse files

core: Move is_class_or_union trait in utils/traits.hpp

parent ab0496b8
No related branches found
No related tags found
No related merge requests found
//
// Copyright (c) 2024 INRIA
//
//
#include <type_traits>
#ifndef __eigenpy_utils_traits_hpp__
#define __eigenpy_utils_traits_hpp__
namespace eigenpy {
namespace details {
/// Trait to detect if T is a class or an union
template <typename T>
struct is_class_or_union
: std::integral_constant<bool, std::is_class<T>::value ||
std::is_union<T>::value> {};
/// Trait to remove cvref and call is_class_or_union
template <typename T>
struct is_class_or_union_remove_cvref
: is_class_or_union<typename std::remove_cv<
typename std::remove_reference<T>::type>::type> {};
} // namespace details
} // namespace eigenpy
#endif // ifndef __eigenpy_utils_traits_hpp__
......@@ -6,6 +6,7 @@
#define __eigenpy_utils_variant_hpp__
#include "eigenpy/fwd.hpp"
#include "eigenpy/utils/traits.hpp"
#include <boost/python.hpp>
#include <boost/variant.hpp>
......@@ -204,18 +205,6 @@ struct VariantValueToObject : VariantVisitorType<PyObject*, Variant> {
using Base::operator();
};
/// Trait to detect if T is a class or an union
template <typename T>
struct is_class_or_union
: std::integral_constant<bool, std::is_class<T>::value ||
std::is_union<T>::value> {};
/// Trait to remove cvref and call is_class_or_union
template <typename T>
struct is_class_or_union_remove_cvref
: is_class_or_union<typename std::remove_cv<
typename std::remove_reference<T>::type>::type> {};
/// Convert {boost,std}::variant<class...> alternative reference to a Python
/// object. This converter return the alternative reference. The code that
/// create the reference holder is taken from \see
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment