Skip to content

Commit

Permalink
Use const xview stepper when underlying expression is const
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Aug 12, 2017
1 parent 0266181 commit a6ed09f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/xtensor/xoptional.hpp
Expand Up @@ -89,6 +89,7 @@ namespace xt
class xoptional
{
public:

using value_closure = CT;
using flag_closure = CB;

Expand Down Expand Up @@ -178,6 +179,7 @@ namespace xt
disable_xoptional<CTO, bool> equal(const CTO& rhs) const noexcept;

private:

template <class CTO, class CBO>
friend class xoptional;

Expand Down
4 changes: 2 additions & 2 deletions include/xtensor/xview.hpp
Expand Up @@ -48,8 +48,8 @@ namespace xt
{
using xexpression_type = std::decay_t<CT>;
using inner_shape_type = typename xview_shape_type<typename xexpression_type::shape_type, S...>::type;
using stepper = xview_stepper<false, CT, S...>;
using const_stepper = xview_stepper<true, CT, S...>;
using stepper = xview_stepper<std::is_const<std::remove_reference_t<CT>>::value, std::remove_cv_t<CT>, S...>;
using const_stepper = xview_stepper<true, std::remove_cv_t<CT>, S...>;
};

/**
Expand Down

0 comments on commit a6ed09f

Please sign in to comment.