mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
sprout/variant/variant.hpp 修正
sprout/weed/attr_cnv/bitwise_or.hpp (variant に対応)
This commit is contained in:
parent
e731c3caf4
commit
e11da4400b
4 changed files with 71 additions and 12 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <sprout/weed/detail/is_elem_and_container.hpp>
|
||||
#include <sprout/weed/detail/is_both_tuple.hpp>
|
||||
#include <sprout/weed/detail/is_same_elem.hpp>
|
||||
#include <sprout/weed/detail/is_different_elem.hpp>
|
||||
#include <sprout/weed/detail/is_elem_and_unused.hpp>
|
||||
#include <sprout/weed/detail/is_unused_and_elem.hpp>
|
||||
#include <sprout/weed/detail/is_both_unused.hpp>
|
||||
|
@ -88,6 +89,14 @@ namespace sprout {
|
|||
>::type bitwise_or(X const& x) {
|
||||
return x;
|
||||
}
|
||||
// V | W -> variant<V, W>
|
||||
template<typename T, typename U, typename X>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::weed::detail::is_different_elem<T, U>::value,
|
||||
typename sprout::weed::attr_cnv::result_of::bitwise_or<T, U>::type
|
||||
>::type bitwise_or(X const& x) {
|
||||
return typename sprout::weed::attr_cnv::result_of::bitwise_or<T, U>::type(x);
|
||||
}
|
||||
// V | unused -> container<V, 1>
|
||||
template<typename T, typename U, typename X>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <sprout/string.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/tuple/tuple.hpp>
|
||||
#include <sprout/variant/variant.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
#include <sprout/weed/traits/type/is_char_type.hpp>
|
||||
#include <sprout/weed/detail/is_same_container.hpp>
|
||||
|
@ -13,6 +14,7 @@
|
|||
#include <sprout/weed/detail/is_elem_and_container.hpp>
|
||||
#include <sprout/weed/detail/is_both_tuple.hpp>
|
||||
#include <sprout/weed/detail/is_same_elem.hpp>
|
||||
#include <sprout/weed/detail/is_different_elem.hpp>
|
||||
#include <sprout/weed/detail/is_elem_and_unused.hpp>
|
||||
#include <sprout/weed/detail/is_unused_and_elem.hpp>
|
||||
#include <sprout/weed/detail/is_both_unused.hpp>
|
||||
|
@ -102,6 +104,18 @@ namespace sprout {
|
|||
public:
|
||||
typedef T type;
|
||||
};
|
||||
// V | W -> variant<V, W>
|
||||
template<typename T, typename U>
|
||||
struct bitwise_or<
|
||||
T,
|
||||
U,
|
||||
typename std::enable_if<
|
||||
sprout::weed::detail::is_different_elem<T, U>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef sprout::variant<T, U> type;
|
||||
};
|
||||
// V | unused -> container<V, 1>
|
||||
template<typename T, typename U>
|
||||
struct bitwise_or<
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue