Shared xexpressions. More...
#include <xexpression.hpp>
Public Types | |
| using | base_class = xexpression<xshared_expression<E>> |
| using | value_type = typename E::value_type |
| using | reference = typename E::reference |
| using | const_reference = typename E::const_reference |
| using | pointer = typename E::pointer |
| using | const_pointer = typename E::const_pointer |
| using | size_type = typename E::size_type |
| using | difference_type = typename E::difference_type |
| using | inner_shape_type = typename E::inner_shape_type |
| using | shape_type = typename E::shape_type |
| using | strides_type |
| using | backstrides_type |
| using | inner_strides_type |
| using | inner_backstrides_type |
| using | storage_type = xtl::mpl::eval_if_t<has_storage_type<E>, detail::expr_storage_type<E>, make_invalid_type<>> |
| using | stepper = typename E::stepper |
| using | const_stepper = typename E::const_stepper |
| using | linear_iterator = decltype(xt::linear_begin(std::declval<E&>())) |
| using | const_linear_iterator = decltype(xt::linear_begin(std::declval<const E&>())) |
| using | reverse_linear_iterator = std::reverse_iterator<linear_iterator> |
| using | const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator> |
| using | bool_load_type = typename E::bool_load_type |
Public Types inherited from xt::xexpression< xshared_expression< E > > | |
| using | derived_type |
Public Member Functions | |
| template<class... Args> | |
| auto | operator() (Args... args) -> decltype(std::declval< E >()(args...)) |
| auto | shape () const -> decltype(std::declval< xtl::constify_t< E > >().shape()) |
| auto | dimension () const -> decltype(std::declval< xtl::constify_t< E > >().dimension()) |
| auto | size () const -> decltype(std::declval< xtl::constify_t< E > >().size()) |
| auto | layout () const -> decltype(std::declval< xtl::constify_t< E > >().layout()) |
| auto | is_contiguous () const -> decltype(std::declval< xtl::constify_t< E > >().is_contiguous()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | begin (const S &shape) noexcept -> decltype(std::declval< E >().template begin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | begin () noexcept -> decltype(std::declval< E >().template begin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | end (const S &shape) noexcept -> decltype(std::declval< E >().template end< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | end () noexcept -> decltype(std::declval< E >().template end< L >()) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | begin () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template begin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | begin (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template begin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | end () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template end< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | end (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template end< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | cbegin () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template cbegin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | cbegin (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template cbegin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | cend () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template cend< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | cend (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template cend< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | rbegin (const S &shape) noexcept -> decltype(std::declval< E >().template rbegin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | rbegin () noexcept -> decltype(std::declval< E >().template rbegin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | rend (const S &shape) noexcept -> decltype(std::declval< E >().template rend< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | rend () noexcept -> decltype(std::declval< E >().template rend< L >()) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | rbegin () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template rbegin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | rbegin (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template rbegin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | rend () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template rend< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | rend (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template rend< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | crbegin () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template crbegin< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | crbegin (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template crbegin< L >(shape)) |
| template<layout_type L = ::xt::layout_type::row_major> | |
| auto | crend () const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template crend< L >()) |
| template<layout_type L = ::xt::layout_type::row_major, class S> | |
| auto | crend (const S &shape) const noexcept -> decltype(std::declval< xtl::constify_t< E > >().template crend< L >(shape)) |
| linear_iterator | linear_begin () noexcept |
| linear_iterator | linear_end () noexcept |
| const_linear_iterator | linear_begin () const noexcept |
| const_linear_iterator | linear_end () const noexcept |
| const_linear_iterator | linear_cbegin () const noexcept |
| const_linear_iterator | linear_cend () const noexcept |
| reverse_linear_iterator | linear_rbegin () noexcept |
| reverse_linear_iterator | linear_rend () noexcept |
| const_reverse_linear_iterator | linear_rbegin () const noexcept |
| const_reverse_linear_iterator | linear_rend () const noexcept |
| const_reverse_linear_iterator | linear_crbegin () const noexcept |
| const_reverse_linear_iterator | linear_crend () const noexcept |
| template<class T = E> | |
| std::enable_if_t< has_strides< T >::value, const inner_strides_type & > | strides () const |
| template<class T = E> | |
| std::enable_if_t< has_strides< T >::value, const inner_strides_type & > | backstrides () const |
| template<class T = E> | |
| std::enable_if_t< has_data_interface< T >::value, pointer > | data () noexcept |
| template<class T = E> | |
| std::enable_if_t< has_data_interface< T >::value, pointer > | data () const noexcept |
| template<class T = E> | |
| std::enable_if_t< has_data_interface< T >::value, size_type > | data_offset () const noexcept |
| template<class T = E> | |
| std::enable_if_t< has_data_interface< T >::value, typename T::storage_type & > | storage () noexcept |
| template<class T = E> | |
| std::enable_if_t< has_data_interface< T >::value, const typename T::storage_type & > | storage () const noexcept |
| template<class It> | |
| reference | element (It first, It last) |
| template<class It> | |
| const_reference | element (It first, It last) const |
| template<class S> | |
| bool | broadcast_shape (S &shape, bool reuse_cache=false) const |
| template<class S> | |
| bool | has_linear_assign (const S &strides) const noexcept |
| template<class S> | |
| auto | stepper_begin (const S &shape) noexcept -> decltype(std::declval< E >().stepper_begin(shape)) |
| template<class S> | |
| auto | stepper_end (const S &shape, layout_type l) noexcept -> decltype(std::declval< E >().stepper_end(shape, l)) |
| template<class S> | |
| auto | stepper_begin (const S &shape) const noexcept -> decltype(std::declval< const E >().stepper_begin(shape)) |
| template<class S> | |
| auto | stepper_end (const S &shape, layout_type l) const noexcept -> decltype(std::declval< const E >().stepper_end(shape, l)) |
Downcast functions | |
| xshared_expression (const std::shared_ptr< E > &ptr) | |
Constructor for xshared expression (note: usually the free function make_xshared is recommended). | |
| long | use_count () const noexcept |
| Return the number of times this expression is referenced. | |
Public Member Functions inherited from xt::xexpression< xshared_expression< E > > | |
| derived_type & | derived_cast () &noexcept |
| Returns a reference to the actual derived type of the xexpression. | |
| const derived_type & | derived_cast () const &noexcept |
| Returns a constant reference to the actual derived type of the xexpression. | |
| derived_type | derived_cast () &&noexcept |
| Returns a constant reference to the actual derived type of the xexpression. | |
| derived_type & | derived_cast () &noexcept |
| Returns a reference to the actual derived type of the xexpression. | |
| const derived_type & | derived_cast () const &noexcept |
| Returns a constant reference to the actual derived type of the xexpression. | |
| derived_type | derived_cast () &&noexcept |
| Returns a constant reference to the actual derived type of the xexpression. | |
Static Public Attributes | |
| static constexpr layout_type | static_layout = E::static_layout |
| static constexpr bool | contiguous_layout = static_layout != layout_type::dynamic |
Additional Inherited Members | |
Protected Member Functions inherited from xt::xexpression< xshared_expression< E > > | |
| xexpression (const xexpression &)=default | |
| xexpression & | operator= (const xexpression &)=default |
| xexpression (xexpression &&)=default | |
| xexpression & | operator= (xexpression &&)=default |
| xexpression (const xexpression &)=default | |
| xexpression (xexpression &&)=default | |
| xexpression & | operator= (const xexpression &)=default |
| xexpression & | operator= (xexpression &&)=default |
Shared xexpressions.
Due to C++ lifetime constraints it's sometimes necessary to create shared expressions (akin to a shared pointer).
For example, when a temporary expression needs to be used twice in another expression, shared expressions can come to the rescue:
Definition at line 511 of file xexpression.hpp.
| using xt::xshared_expression< E >::backstrides_type |
Definition at line 530 of file xexpression.hpp.
| using xt::xshared_expression< E >::base_class = xexpression<xshared_expression<E>> |
Definition at line 515 of file xexpression.hpp.
| using xt::xshared_expression< E >::bool_load_type = typename E::bool_load_type |
Definition at line 546 of file xexpression.hpp.
| using xt::xshared_expression< E >::const_linear_iterator = decltype(xt::linear_begin(std::declval<const E&>())) |
Definition at line 542 of file xexpression.hpp.
| using xt::xshared_expression< E >::const_pointer = typename E::const_pointer |
Definition at line 521 of file xexpression.hpp.
| using xt::xshared_expression< E >::const_reference = typename E::const_reference |
Definition at line 519 of file xexpression.hpp.
| using xt::xshared_expression< E >::const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator> |
Definition at line 544 of file xexpression.hpp.
| using xt::xshared_expression< E >::const_stepper = typename E::const_stepper |
Definition at line 539 of file xexpression.hpp.
| using xt::xshared_expression< E >::difference_type = typename E::difference_type |
Definition at line 523 of file xexpression.hpp.
| using xt::xshared_expression< E >::inner_backstrides_type |
Definition at line 534 of file xexpression.hpp.
| using xt::xshared_expression< E >::inner_shape_type = typename E::inner_shape_type |
Definition at line 525 of file xexpression.hpp.
| using xt::xshared_expression< E >::inner_strides_type |
Definition at line 532 of file xexpression.hpp.
| using xt::xshared_expression< E >::linear_iterator = decltype(xt::linear_begin(std::declval<E&>())) |
Definition at line 541 of file xexpression.hpp.
| using xt::xshared_expression< E >::pointer = typename E::pointer |
Definition at line 520 of file xexpression.hpp.
| using xt::xshared_expression< E >::reference = typename E::reference |
Definition at line 518 of file xexpression.hpp.
| using xt::xshared_expression< E >::reverse_linear_iterator = std::reverse_iterator<linear_iterator> |
Definition at line 543 of file xexpression.hpp.
| using xt::xshared_expression< E >::shape_type = typename E::shape_type |
Definition at line 526 of file xexpression.hpp.
| using xt::xshared_expression< E >::size_type = typename E::size_type |
Definition at line 522 of file xexpression.hpp.
| using xt::xshared_expression< E >::stepper = typename E::stepper |
Definition at line 538 of file xexpression.hpp.
| using xt::xshared_expression< E >::storage_type = xtl::mpl::eval_if_t<has_storage_type<E>, detail::expr_storage_type<E>, make_invalid_type<>> |
Definition at line 536 of file xexpression.hpp.
| using xt::xshared_expression< E >::strides_type |
Definition at line 528 of file xexpression.hpp.
| using xt::xshared_expression< E >::value_type = typename E::value_type |
Definition at line 517 of file xexpression.hpp.
|
inlineexplicit |
Constructor for xshared expression (note: usually the free function make_xshared is recommended).
| ptr | shared ptr that contains the expression |
Definition at line 746 of file xexpression.hpp.
|
inline |
Definition at line 647 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 568 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 566 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 568 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 566 of file xexpression.hpp.
|
inline |
Definition at line 695 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 570 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 570 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 571 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 571 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 577 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 577 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 578 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 578 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 659 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 653 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 665 of file xexpression.hpp.
|
inline |
Definition at line 561 of file xexpression.hpp.
|
inline |
Definition at line 683 of file xexpression.hpp.
|
inline |
Definition at line 689 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 569 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 567 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 569 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 567 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 701 of file xexpression.hpp.
|
inline |
Definition at line 564 of file xexpression.hpp.
|
inline |
Definition at line 563 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 590 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 580 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 600 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 605 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 630 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 635 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 595 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 585 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 620 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 610 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 625 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 615 of file xexpression.hpp.
|
inline |
Definition at line 555 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 575 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 573 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 575 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 573 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 576 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 574 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 576 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 574 of file xexpression.hpp.
|
inline |
Definition at line 560 of file xexpression.hpp.
|
inline |
Definition at line 562 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 720 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 707 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 727 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 713 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 677 of file xexpression.hpp.
|
inlinenoexcept |
Definition at line 671 of file xexpression.hpp.
|
inline |
Definition at line 641 of file xexpression.hpp.
|
inlinenoexcept |
Return the number of times this expression is referenced.
Internally calls the use_count() function of the std::shared_ptr.
Definition at line 756 of file xexpression.hpp.
|
staticconstexpr |
Definition at line 549 of file xexpression.hpp.
|
staticconstexpr |
Definition at line 548 of file xexpression.hpp.