10 #ifndef TEUCHOS_ARRAY_VIEW_DECL_HPP
11 #define TEUCHOS_ARRAY_VIEW_DECL_HPP
15 #include "Teuchos_ENull.hpp"
16 #include "Teuchos_NullIteratorTraits.hpp"
22 template<
class T>
class ArrayRCP;
123 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
173 ArrayView (std::vector<
typename std::remove_const_t<T>>& vec);
176 ArrayView (
const std::vector<
typename std::remove_const_t<T>>& vec);
207 inline T*
data()
const;
337 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
352 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
356 void setUpIterators(
const ERCPNodeLookup rcpNodeLookup = RCP_ENABLE_NODE_LOOKUP);
358 void debug_assert_not_null()
const {
359 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
365 (void)offset; (void)size_in;
366 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
371 void debug_assert_valid_ptr()
const {
372 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
373 arcp_.access_private_node().assert_valid_ptr(*
this);
381 T* access_private_ptr()
const
384 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
385 ArrayRCP<T> access_private_arcp()
const
402 typedef Teuchos_Ordinal
Ordinal;
411 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
426 ArrayView (std::vector<
typename std::remove_const_t<T>>& vec);
428 ArrayView (
const std::vector<
typename std::remove_const_t<T>>& vec);
436 size_type
size()
const;
442 inline const T*
data()
const;
446 const T&
front()
const;
448 const T&
back()
const;
463 iterator
begin()
const;
465 iterator
end()
const;
471 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
486 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
490 void setUpIterators(
const ERCPNodeLookup rcpNodeLookup = RCP_ENABLE_NODE_LOOKUP);
492 void debug_assert_not_null()
const {
493 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
498 void debug_assert_in_range( size_type offset, size_type size_in )
const {
499 (void)offset; (void)size_in;
500 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
505 void debug_assert_valid_ptr()
const {
506 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
507 arcp_.access_private_node().assert_valid_ptr(*
this);
515 const T* access_private_ptr()
const {
return ptr_; }
517 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
537 ArrayView<T> arrayViewFromVector( std::vector<T>& vec );
606 std::ostream& operator<<( std::ostream& out, const ArrayView<T>& av );
617 template<
class T2,
class T1>
633 template<
class T2,
class T1>
648 #endif // TEUCHOS_ARRAY_VIEW_DECL_HPP
T & reference
Type of a reference to an array element.
std::string toString() const
Convert an ArrayView<T> to an std::string
T & front() const
Get the first element.
const T * const_pointer
Type of a const pointer to an array element.
pointer iterator
Type of a nonconst iterator.
bool is_null() const
Returns true if the underlying pointer is null.
const ArrayView< T > & assert_in_range(size_type offset, size_type size) const
Throws NullReferenceError if this->get()==NULL orthis->get()!=NULL, throws RangeError if (offset < 0 ...
Partial specialization of ArrayRCP for const T.
const T & const_reference
Type of a const reference to an array element.
iterator begin() const
Return an iterator to beginning of the array of data.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
const_pointer const_iterator
Type of a const iterator.
Ordinal size_type
Type representing the number of elements in an ArrayRCP or view thereof.
size_type size() const
The total number of items in the managed array.
ENull
Used to initialize a RCP object to NULL using an implicit conversion!
T * data() const
Return a raw pointer to beginning of array.
void assign(const ArrayView< const T > &array) const
Copy the data from one array view object to this array view object.
Teuchos_Ordinal Ordinal
Integer index type used throughout ArrayView.
T * pointer
Type of a pointer to an array element.
T * getRawPtr() const
Return a raw pointer to beginning of array or NULL if unsized.
const ArrayView< T > & assert_not_null() const
Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
T value_type
Type of each array element.
const ArrayView< T > & operator()() const
Return *this (just for compatibility with Array and ArrayPtr).
ERCPNodeLookup
Used to determine if RCPNode lookup is performed or not.
ArrayView(ENull null_arg=null)
Constructor that initializes to NULL (implicitly or explicitly).
iterator end() const
Return an iterator to past the end of the array of data.
ArrayView< T > view(size_type offset, size_type size) const
Return a view of a contiguous range of elements.
Partial specialization of ArrayView for const T.
T & operator[](size_type i) const
Random object access.
Reference-counted pointer node classes.
Ordinal difference_type
Type representing the difference between two size_type values.
ArrayView< T > & operator=(const ArrayView< T > &array)
Shallow copy assignment operator.
ArrayView< const T > getConst() const
Return a const view of a possibly nonconst view.
T & back() const
Get the last element.
Reference-counted smart pointer for managing arrays.