215 using enable_xcontainer_semantics =
typename std::enable_if<has_container_semantics<E>::value,
R>::type;
218 using disable_xcontainer_semantics =
typename std::enable_if<!has_container_semantics<E>::value,
R>::type;
260 using temporary_type =
typename base_type::temporary_type;
270 template <
class E,
class F>
291 template <
class E,
class R =
void>
292 using enable_xview_semantics =
typename std::enable_if<has_view_semantics<E>::value,
R>::type;
294 template <
class E,
class R =
void>
295 using disable_xview_semantics =
typename std::enable_if<!has_view_semantics<E>::value,
R>::type;
314 return this->derived_cast().scalar_computed_assign(
e, std::plus<>());
326 return this->derived_cast().scalar_computed_assign(
e, std::minus<>());
338 return this->derived_cast().scalar_computed_assign(
e, std::multiplies<>());
350 return this->derived_cast().scalar_computed_assign(
e, std::divides<>());
362 return this->derived_cast().scalar_computed_assign(
e, std::modulus<>());
374 return this->derived_cast().scalar_computed_assign(
e, std::bit_and<>());
386 return this->derived_cast().scalar_computed_assign(
e, std::bit_or<>());
398 return this->derived_cast().scalar_computed_assign(
e, std::bit_xor<>());
410 return this->derived_cast() = this->derived_cast() +
e.derived_cast();
422 return this->derived_cast() = this->derived_cast() -
e.derived_cast();
434 return this->derived_cast() = this->derived_cast() *
e.derived_cast();
446 return this->derived_cast() = this->derived_cast() /
e.derived_cast();
458 return this->derived_cast() = this->derived_cast() %
e.derived_cast();
470 return this->derived_cast() = this->derived_cast() &
e.derived_cast();
482 return this->derived_cast() = this->derived_cast() |
e.derived_cast();
494 return this->derived_cast() = this->derived_cast() ^
e.derived_cast();
513 return this->derived_cast().assign_xexpression(
e);
526 return this->derived_cast().computed_assign(this->derived_cast() +
e.derived_cast());
539 return this->derived_cast().computed_assign(this->derived_cast() -
e.derived_cast());
552 return this->derived_cast().computed_assign(this->derived_cast() *
e.derived_cast());
565 return this->derived_cast().computed_assign(this->derived_cast() /
e.derived_cast());
578 return this->derived_cast().computed_assign(this->derived_cast() %
e.derived_cast());
591 return this->derived_cast().computed_assign(this->derived_cast() &
e.derived_cast());
604 return this->derived_cast().computed_assign(this->derived_cast() |
e.derived_cast());
617 return this->derived_cast().computed_assign(this->derived_cast() ^
e.derived_cast());
624#ifdef XTENSOR_FORCE_TEMPORARY_MEMORY_IN_ASSIGNMENTS
626 return this->derived_cast().assign_temporary(std::move(
tmp));
637 return this->assign(e);
654 return (this->derived_cast() = std::move(
tmp));
661 xt::assign_xexpression(*
this,
e);
662 return this->derived_cast();
667 inline auto xcontainer_semantic<D>::computed_assign(
const xexpression<E>& e) -> derived_type&
669 xt::computed_assign(*
this, e);
670 return this->derived_cast();
674 template <
class E,
class F>
675 inline auto xcontainer_semantic<D>::scalar_computed_assign(
const E& e, F&& f) -> derived_type&
677 xt::scalar_computed_assign(*
this, e, std::forward<F>(f));
678 return this->derived_cast();
683 inline auto xcontainer_semantic<D>::operator=(
const xexpression<E>& e) -> derived_type&
685 return base_type::operator=(e);
700 this->derived_cast().assign_temporary_impl(std::move(
tmp));
701 return this->derived_cast();
707 bool get_rhs_triviality(
const F&)
712 template <
class F,
class R,
class... CT>
713 bool get_rhs_triviality(
const xfunction<F, R, CT...>& rhs)
715 using index_type = xindex_type_t<
typename xfunction<F, R, CT...>::shape_type>;
716 using size_type =
typename index_type::size_type;
717 size_type size = rhs.dimension();
718 index_type shape = uninitialized_shape<index_type>(size);
719 bool trivial_broadcast = rhs.broadcast_shape(shape,
true);
720 return trivial_broadcast;
726 inline auto xview_semantic<D>::assign_xexpression(
const xexpression<E>& e) -> derived_type&
728 xt::assert_compatible_shape(*
this, e);
729 xt::assign_data(*
this, e, detail::get_rhs_triviality(e.derived_cast()));
730 return this->derived_cast();
735 inline auto xview_semantic<D>::computed_assign(
const xexpression<E>& e) -> derived_type&
737 xt::assert_compatible_shape(*
this, e);
738 xt::assign_data(*
this, e, detail::get_rhs_triviality(e.derived_cast()));
739 return this->derived_cast();
742 namespace xview_semantic_detail
745 auto get_begin(D&& lhs, std::true_type)
747 return lhs.linear_begin();
751 auto get_begin(D&& lhs, std::false_type)
758 template <
class E,
class F>
759 inline auto xview_semantic<D>::scalar_computed_assign(
const E& e, F&& f) -> derived_type&
761 D& d = this->derived_cast();
763 using size_type =
typename D::size_type;
764 auto dst = xview_semantic_detail::get_begin(d, std::integral_constant<bool, D::contiguous_layout>());
765 for (size_type i = d.size(); i > 0; --i)
770 return this->derived_cast();
775 inline auto xview_semantic<D>::operator=(
const xexpression<E>& rhs) -> derived_type&
777 bool cond = (rhs.derived_cast().shape().size() == this->derived_cast().dimension())
779 this->derived_cast().shape().begin(),
780 this->derived_cast().shape().end(),
781 rhs.derived_cast().shape().begin()
786 base_type::operator=(
broadcast(rhs.derived_cast(), this->derived_cast().shape()));
790 base_type::operator=(rhs);
792 return this->derived_cast();