Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions include/xtensor/containers/xcontainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ namespace xt

size_type size() const noexcept;

XTENSOR_CONSTEXPR_RETURN size_type dimension() const noexcept;
constexpr size_type dimension() const noexcept;

XTENSOR_CONSTEXPR_RETURN const inner_shape_type& shape() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_strides_type& strides() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_backstrides_type& backstrides() const noexcept;
constexpr const inner_shape_type& shape() const noexcept;
constexpr const inner_strides_type& strides() const noexcept;
constexpr const inner_backstrides_type& backstrides() const noexcept;

template <class T>
void fill(const T& value);
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace xt
* Returns the number of dimensions of the container.
*/
template <class D>
XTENSOR_CONSTEXPR_RETURN auto xcontainer<D>::dimension() const noexcept -> size_type
constexpr auto xcontainer<D>::dimension() const noexcept -> size_type
{
return shape().size();
}
Expand All @@ -382,7 +382,7 @@ namespace xt
* Returns the shape of the container.
*/
template <class D>
XTENSOR_CONSTEXPR_RETURN auto xcontainer<D>::shape() const noexcept -> const inner_shape_type&
constexpr auto xcontainer<D>::shape() const noexcept -> const inner_shape_type&
{
return derived_cast().shape_impl();
}
Expand All @@ -391,7 +391,7 @@ namespace xt
* Returns the strides of the container.
*/
template <class D>
XTENSOR_CONSTEXPR_RETURN auto xcontainer<D>::strides() const noexcept -> const inner_strides_type&
constexpr auto xcontainer<D>::strides() const noexcept -> const inner_strides_type&
{
return derived_cast().strides_impl();
}
Expand All @@ -400,7 +400,7 @@ namespace xt
* Returns the backstrides of the container.
*/
template <class D>
XTENSOR_CONSTEXPR_RETURN auto xcontainer<D>::backstrides() const noexcept -> const inner_backstrides_type&
constexpr auto xcontainer<D>::backstrides() const noexcept -> const inner_backstrides_type&
{
return derived_cast().backstrides_impl();
}
Expand Down
26 changes: 12 additions & 14 deletions include/xtensor/containers/xfixed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ namespace xt
storage_type& storage_impl() noexcept;
const storage_type& storage_impl() const noexcept;

XTENSOR_CONSTEXPR_RETURN const inner_shape_type& shape_impl() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_strides_type& strides_impl() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_backstrides_type& backstrides_impl() const noexcept;
constexpr const inner_shape_type& shape_impl() const noexcept;
constexpr const inner_strides_type& strides_impl() const noexcept;
constexpr const inner_backstrides_type& backstrides_impl() const noexcept;

friend class xcontainer<xfixed_container<ET, S, L, SH, Tag>>;
};
Expand Down Expand Up @@ -495,9 +495,9 @@ namespace xt
storage_type& storage_impl() noexcept;
const storage_type& storage_impl() const noexcept;

XTENSOR_CONSTEXPR_RETURN const inner_shape_type& shape_impl() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_strides_type& strides_impl() const noexcept;
XTENSOR_CONSTEXPR_RETURN const inner_backstrides_type& backstrides_impl() const noexcept;
constexpr const inner_shape_type& shape_impl() const noexcept;
constexpr const inner_strides_type& strides_impl() const noexcept;
constexpr const inner_backstrides_type& backstrides_impl() const noexcept;

friend class xcontainer<xfixed_adaptor<EC, S, L, SH, Tag>>;
};
Expand Down Expand Up @@ -740,21 +740,20 @@ namespace xt
}

template <class ET, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_container<ET, S, L, SH, Tag>::shape_impl() const noexcept
-> const inner_shape_type&
constexpr auto xfixed_container<ET, S, L, SH, Tag>::shape_impl() const noexcept -> const inner_shape_type&
{
return m_shape;
}

template <class ET, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_container<ET, S, L, SH, Tag>::strides_impl() const noexcept
constexpr auto xfixed_container<ET, S, L, SH, Tag>::strides_impl() const noexcept
-> const inner_strides_type&
{
return m_strides;
}

template <class ET, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_container<ET, S, L, SH, Tag>::backstrides_impl() const noexcept
constexpr auto xfixed_container<ET, S, L, SH, Tag>::backstrides_impl() const noexcept
-> const inner_backstrides_type&
{
return m_backstrides;
Expand Down Expand Up @@ -937,21 +936,20 @@ namespace xt
}

template <class EC, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_adaptor<EC, S, L, SH, Tag>::shape_impl() const noexcept
-> const inner_shape_type&
constexpr auto xfixed_adaptor<EC, S, L, SH, Tag>::shape_impl() const noexcept -> const inner_shape_type&
{
return m_shape;
}

template <class EC, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_adaptor<EC, S, L, SH, Tag>::strides_impl() const noexcept
constexpr auto xfixed_adaptor<EC, S, L, SH, Tag>::strides_impl() const noexcept
-> const inner_strides_type&
{
return m_strides;
}

template <class EC, class S, layout_type L, bool SH, class Tag>
XTENSOR_CONSTEXPR_RETURN auto xfixed_adaptor<EC, S, L, SH, Tag>::backstrides_impl() const noexcept
constexpr auto xfixed_adaptor<EC, S, L, SH, Tag>::backstrides_impl() const noexcept
-> const inner_backstrides_type&
{
return m_backstrides;
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/containers/xscalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,25 +466,25 @@ namespace xt
*****************************/

template <class CT>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(xscalar<CT>& c) noexcept -> decltype(c.dummy_begin())
constexpr auto linear_begin(xscalar<CT>& c) noexcept -> decltype(c.dummy_begin())
{
return c.dummy_begin();
}

template <class CT>
XTENSOR_CONSTEXPR_RETURN auto linear_end(xscalar<CT>& c) noexcept -> decltype(c.dummy_end())
constexpr auto linear_end(xscalar<CT>& c) noexcept -> decltype(c.dummy_end())
{
return c.dummy_end();
}

template <class CT>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(const xscalar<CT>& c) noexcept -> decltype(c.dummy_begin())
constexpr auto linear_begin(const xscalar<CT>& c) noexcept -> decltype(c.dummy_begin())
{
return c.dummy_begin();
}

template <class CT>
XTENSOR_CONSTEXPR_RETURN auto linear_end(const xscalar<CT>& c) noexcept -> decltype(c.dummy_end())
constexpr auto linear_end(const xscalar<CT>& c) noexcept -> decltype(c.dummy_end())
{
return c.dummy_end();
}
Expand Down
22 changes: 7 additions & 15 deletions include/xtensor/containers/xstorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,13 +1658,7 @@ namespace xt
{
public:

#if defined(_MSC_VER)
using cast_type = std::array<std::size_t, sizeof...(X)>;
#define XTENSOR_FIXED_SHAPE_CONSTEXPR inline
#else
using cast_type = const_array<std::size_t, sizeof...(X)>;
#define XTENSOR_FIXED_SHAPE_CONSTEXPR constexpr
#endif
using value_type = std::size_t;
using size_type = std::size_t;
using const_iterator = typename cast_type::const_iterator;
Expand All @@ -1681,17 +1675,17 @@ namespace xt
return std::get<idx>(tmp_cast_type{X...});
}

XTENSOR_FIXED_SHAPE_CONSTEXPR operator cast_type() const
constexpr operator cast_type() const
{
return cast_type({X...});
}

XTENSOR_FIXED_SHAPE_CONSTEXPR auto begin() const
constexpr auto begin() const
{
return m_array.begin();
}

XTENSOR_FIXED_SHAPE_CONSTEXPR auto end() const
constexpr auto end() const
{
return m_array.end();
}
Expand All @@ -1706,22 +1700,22 @@ namespace xt
return m_array.rend();
}

XTENSOR_FIXED_SHAPE_CONSTEXPR auto cbegin() const
constexpr auto cbegin() const
{
return m_array.cbegin();
}

XTENSOR_FIXED_SHAPE_CONSTEXPR auto cend() const
constexpr auto cend() const
{
return m_array.cend();
}

XTENSOR_FIXED_SHAPE_CONSTEXPR std::size_t operator[](std::size_t idx) const
constexpr std::size_t operator[](std::size_t idx) const
{
return m_array[idx];
}

XTENSOR_FIXED_SHAPE_CONSTEXPR bool empty() const
constexpr bool empty() const
{
return sizeof...(X) == 0;
}
Expand All @@ -1731,8 +1725,6 @@ namespace xt
XTENSOR_CONSTEXPR_ENHANCED_STATIC cast_type m_array = cast_type({X...});
};

#undef XTENSOR_FIXED_SHAPE_CONSTEXPR

template <class E, std::ptrdiff_t Start, std::ptrdiff_t End = -1>
class sequence_view
{
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/core/xiterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ namespace xt
}

template <class C>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(C& c) noexcept
constexpr auto linear_begin(C& c) noexcept
{
if constexpr (detail::has_linear_iterator<C>::value)
{
Expand All @@ -430,7 +430,7 @@ namespace xt
}

template <class C>
XTENSOR_CONSTEXPR_RETURN auto linear_end(C& c) noexcept
constexpr auto linear_end(C& c) noexcept
{
if constexpr (detail::has_linear_iterator<C>::value)
{
Expand All @@ -443,7 +443,7 @@ namespace xt
}

template <class C>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(const C& c) noexcept
constexpr auto linear_begin(const C& c) noexcept
{
if constexpr (detail::has_linear_iterator<C>::value)
{
Expand All @@ -456,7 +456,7 @@ namespace xt
}

template <class C>
XTENSOR_CONSTEXPR_RETURN auto linear_end(const C& c) noexcept
constexpr auto linear_end(const C& c) noexcept
{
if constexpr (detail::has_linear_iterator<C>::value)
{
Expand Down
5 changes: 0 additions & 5 deletions include/xtensor/core/xtensor_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@

// Workaround for some missing constexpr functionality in MSVC 2015 and MSVC 2017 x86
#if defined(_MSC_VER)
#define XTENSOR_CONSTEXPR_ENHANCED const
// The following must not be defined to const, otherwise
// it prevents generation of copy operators of classes
// containing XTENSOR_CONSTEXPR_ENHANCED_STATIC members
#define XTENSOR_CONSTEXPR_ENHANCED_STATIC
#define XTENSOR_CONSTEXPR_RETURN inline
#else
#define XTENSOR_CONSTEXPR_ENHANCED constexpr
#define XTENSOR_CONSTEXPR_RETURN constexpr
#define XTENSOR_CONSTEXPR_ENHANCED_STATIC constexpr static
#define XTENSOR_HAS_CONSTEXPR_ENHANCED
#endif

#ifndef XTENSOR_DEFAULT_DATA_CONTAINER
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/views/xbroadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@ namespace xt
*****************************/

template <class CT, class X>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(xbroadcast<CT, X>& c) noexcept
constexpr auto linear_begin(xbroadcast<CT, X>& c) noexcept
{
return linear_begin(c.expression());
}

template <class CT, class X>
XTENSOR_CONSTEXPR_RETURN auto linear_end(xbroadcast<CT, X>& c) noexcept
constexpr auto linear_end(xbroadcast<CT, X>& c) noexcept
{
return linear_end(c.expression());
}

template <class CT, class X>
XTENSOR_CONSTEXPR_RETURN auto linear_begin(const xbroadcast<CT, X>& c) noexcept
constexpr auto linear_begin(const xbroadcast<CT, X>& c) noexcept
{
return linear_begin(c.expression());
}

template <class CT, class X>
XTENSOR_CONSTEXPR_RETURN auto linear_end(const xbroadcast<CT, X>& c) noexcept
constexpr auto linear_end(const xbroadcast<CT, X>& c) noexcept
{
return linear_end(c.expression());
}
Expand Down
Loading
Loading