16.01.2011 - new modules - pimath and pigeometry
This commit is contained in:
17
piincludes.h
17
piincludes.h
@@ -44,6 +44,20 @@ using std::list;
|
||||
using std::deque;
|
||||
using std::string;
|
||||
|
||||
template<typename Type, typename Allocator = std::allocator<Type> >
|
||||
class PIVector: public vector<Type, Allocator> {
|
||||
public:
|
||||
inline const Type & at(uint index) const {return (*this)[index];}
|
||||
inline Type & at(uint index) {return (*this)[index];}
|
||||
inline const Type * data(uint index = 0) const {return &(*this)[index];}
|
||||
inline Type * data(uint index = 0) {return &(*this)[index];}
|
||||
inline void pop_front() {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin());}
|
||||
inline void push_front(const Type & t) {vector<Type, Allocator>::insert(vector<Type, Allocator>::begin(), t);}
|
||||
inline void remove(uint num) {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin() + num);}
|
||||
inline void remove(uint num, uint count) {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin() + num, vector<Type, Allocator>::begin() + num + count);}
|
||||
inline void insert(uint pos, const Type & t) {vector<Type, Allocator>::insert(vector<Type, Allocator>::begin() + pos, t);}
|
||||
};
|
||||
|
||||
template<typename Enum>
|
||||
class Flags {
|
||||
private:
|
||||
@@ -70,6 +84,9 @@ public:
|
||||
inline operator int() const {return flags;}
|
||||
};
|
||||
|
||||
#ifdef WINDOWS
|
||||
inline int random() {return rand();}
|
||||
#endif
|
||||
|
||||
inline bool atob(const string & str) { return str == "1" ? true : false;};
|
||||
inline string btos(const bool num) { return num ? "0" : "1";};
|
||||
|
||||
Reference in New Issue
Block a user