Skip to content

Commit 06cb913

Browse files
authored
Merge pull request #2275 from JohanMabille/layout
Moved layout_remove_any to xlayout.hpp
2 parents d85e535 + e17a828 commit 06cb913

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

include/xtensor/xeval.hpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ namespace xt
5050

5151
namespace detail
5252
{
53-
/************************************
54-
* layout_remove_any implementation *
55-
************************************/
56-
57-
constexpr layout_type layout_remove_any(const layout_type layout)
58-
{
59-
return layout == layout_type::any ? XTENSOR_DEFAULT_LAYOUT : layout;
60-
}
61-
6253
/**********************************
6354
* has_same_layout implementation *
6455
**********************************/
@@ -102,7 +93,7 @@ namespace xt
10293
****************************************/
10394

10495
template <class E, layout_type L>
105-
using as_xarray_container_t = xarray<typename std::decay_t<E>::value_type, detail::layout_remove_any(L)>;
96+
using as_xarray_container_t = xarray<typename std::decay_t<E>::value_type, layout_remove_any(L)>;
10697

10798
/*****************************************
10899
* as_xtensor_container_t implementation *
@@ -111,7 +102,7 @@ namespace xt
111102
template <class E, layout_type L>
112103
using as_xtensor_container_t = xtensor<typename std::decay_t<E>::value_type,
113104
std::tuple_size<typename std::decay_t<E>::shape_type>::value,
114-
detail::layout_remove_any(L)>;
105+
layout_remove_any(L)>;
115106
}
116107

117108
/**

include/xtensor/xlayout.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ namespace xt
5252

5353
constexpr layout_type default_assignable_layout(layout_type l) noexcept;
5454

55+
constexpr layout_type layout_remove_any(const layout_type layout) noexcept;
56+
5557
/******************
5658
* Implementation *
5759
******************/
@@ -92,6 +94,11 @@ namespace xt
9294
return (l == layout_type::row_major || l == layout_type::column_major) ?
9395
l : XTENSOR_DEFAULT_LAYOUT;
9496
}
97+
98+
constexpr layout_type layout_remove_any(const layout_type layout) noexcept
99+
{
100+
return layout == layout_type::any ? XTENSOR_DEFAULT_LAYOUT : layout;
101+
}
95102
}
96103

97104
#endif

0 commit comments

Comments
 (0)