1 | #ifndef FASTUIDRAW_DEMO_CAST_C_ARRAY_HPP |
2 | #define FASTUIDRAW_DEMO_CAST_C_ARRAY_HPP |
3 | |
4 | #include <vector> |
5 | #include <fastuidraw/util/c_array.hpp> |
6 | |
7 | template<typename T> |
8 | fastuidraw::c_array<const T> |
9 | cast_c_array(const std::vector<T> &p) |
10 | { |
11 | return (p.empty()) ? |
12 | fastuidraw::c_array<const T>() : |
13 | fastuidraw::c_array<const T>(&p[0], p.size()); |
14 | } |
15 | |
16 | template<typename T> |
17 | fastuidraw::c_array<const T> |
18 | const_cast_c_array(const std::vector<T> &p) |
19 | { |
20 | return (p.empty()) ? |
21 | fastuidraw::c_array<const T>() : |
22 | fastuidraw::c_array<const T>(&p[0], p.size()); |
23 | } |
24 | |
25 | template<typename T> |
26 | fastuidraw::c_array<T> |
27 | cast_c_array(std::vector<T> &p) |
28 | { |
29 | return (p.empty()) ? |
30 | fastuidraw::c_array<T>() : |
31 | fastuidraw::c_array<T>(&p[0], p.size()); |
32 | } |
33 | |
34 | #endif |
35 | |