remove button colors from quarks gui (cocoa + swing)
[supercollider.git] / external_libraries / yaml-cpp-0.2.6 / src / ptr_vector.h
blob498c18106faa12bf08446c670eefa35c945447b1
1 #ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 #if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
8 #include "yaml-cpp/noncopyable.h"
9 #include <memory>
10 #include <vector>
11 #include <cstddef>
13 namespace YAML {
15 template <typename T>
16 class ptr_vector: private YAML::noncopyable
18 public:
19 ptr_vector() {}
20 ~ptr_vector() { clear(); }
22 void clear() {
23 for(unsigned i=0;i<m_data.size();i++)
24 delete m_data[i];
25 m_data.clear();
28 std::size_t size() const { return m_data.size(); }
29 bool empty() const { return m_data.empty(); }
31 void push_back(std::auto_ptr<T> t) {
32 m_data.push_back(NULL);
33 m_data.back() = t.release();
35 T& operator[](std::size_t i) { return *m_data[i]; }
36 const T& operator[](std::size_t i) const { return *m_data[i]; }
38 T& back() { return *m_data.back(); }
39 const T& back() const { return *m_data.back(); }
41 private:
42 std::vector<T*> m_data;
46 #endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66