Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_getRawPtr.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_GETRAWPTR_HPP
11 #define TEUCHOS_GETRAWPTR_HPP
12 
13 #include "Teuchos_ArrayRCP.hpp"
14 
15 namespace Teuchos {
16 
17 template<class Container>
19  // Empty : will fail if specialization doesn't exist
20 };
21 
22 
23 template<class Container>
25 getRawPtr( const Container& c )
26 {
28 }
29 
30 
31 // partial specialization for C pointer
32 template<class RawType>
34 {
35 public:
36  typedef RawType* Ptr_t;
37  static Ptr_t getRawPtr( RawType* p ) { return p; }
38 };
39 
40 // partial specialization for ArrayRCP
41 template<class T>
43 {
44 public:
45  typedef typename ArrayRCP<T>::pointer Ptr_t;
46  static Ptr_t getRawPtr( const ArrayRCP<T>& arcp ) { return arcp.getRawPtr(); }
47 };
48 
49 // ToDo: Add specializations as needed!
50 
51 } // namespace Teuchos
52 
53 #endif // TEUCHOS_GETRAWPTR_HPP
54 
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
RawPointerConversionTraits< Container >::Ptr_t getRawPtr(const Container &c)
static Ptr_t getRawPtr(const ArrayRCP< T > &arcp)
T * pointer
Type of a (raw) (nonconstant) pointer to an array element.
Reference-counted smart pointer for managing arrays.