inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_vdata 00005 #define inlib_vdata 00006 00007 #include <vector> 00008 00009 namespace inlib { 00010 00011 template <class T> 00012 inline const T* vec_data(const std::vector<T>& a_vec) { 00013 #if TARGET_OS_IPHONE || WIN32 || __INTEL_COMPILER 00014 const T& vf = a_vec.front(); 00015 return &vf; 00016 #else 00017 return a_vec.data(); 00018 #endif 00019 } 00020 00021 template <class T> 00022 inline T* vec_data(std::vector<T>& a_vec) { 00023 #if TARGET_OS_IPHONE || WIN32 || __INTEL_COMPILER 00024 T& vf = a_vec.front(); 00025 return &vf; 00026 #else 00027 return a_vec.data(); 00028 #endif 00029 } 00030 00031 } 00032 00033 #endif