Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_PtrFromStlVector.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef PANZER_PTR_FROM_STL_VECTOR_HPP
12 #define PANZER_PTR_FROM_STL_VECTOR_HPP
13 
14 #include <vector>
15 
16 namespace panzer {
17 
31  template <typename T>
32  inline T* ptrFromStlVector(std::vector<T>& v)
33  {
34 #ifdef _GLIBCXX_DEBUG
35  if (v.size() > 0)
36  return &v[0];
37 
38  return NULL;
39 #else
40  return &v[0];
41 #endif
42  }
43 
44 }
45 
46 #endif
T * ptrFromStlVector(std::vector< T > &v)