📄 pvec.hp
字号:
/* : light weight Vector: This will simply reuse code from *//* a VoidP Vec, which was genclassed from the Vec libg++ class. *//* The classes generated from this file will all be derived classes *//* from class VoidVec or intVec. No .cc file is generated. So *//* it costs nothing to use these type-safe Vectors. Only member *//* functions needing type casting are re-defined. *//* */#ifndef _<T>Vec_h#define _<T>Vec_h 1#include "VoidP.Vec.h"#include "<T>.defs.h"#ifndef _<T>_typedefs#define _<T>_typedefs 1typedef void (*<T>Procedure)(<T> );typedef <T> (*<T>Mapper)(<T> );typedef <T> (*<T>Combiner)(<T> , <T> );typedef int (*<T>Predicate)(<T> );typedef int (*<T>Comparator)(<T> , <T> );#endifclass <T>Vec : public VoidPVec{protected: <T>Vec(int l, <T>* d) : (l, (VoidP*) d) {};public: <T>Vec() {}; <T>Vec(int l) : (l) {}; <T>Vec(int l, <T&> fill_value) : (l, fill_value) {}; <T>Vec(<T>Vec& v) : (v) {}; <T>Vec(VoidPVec& v) {fake_copy(v, s, len);} ~<T>Vec() {}; <T>Vec& operator = (<T>Vec& a) {return (<T>Vec&) VoidPVec::operator= (a);} <T>Vec at(int from, int n) {return (<T>Vec) VoidPVec::at(from, n);} <T>& operator [] (int n) {return (<T>&)VoidPVec::operator[] (n);} <T>& elem(int n) {return (<T>&)VoidPVec::elem(n);} friend <T>Vec concat(<T>Vec& a, <T>Vec& b); friend <T>Vec map(<T>Mapper f, <T>Vec & a); friend <T>Vec merge(<T>Vec & a, <T>Vec & b, <T>Comparator f); friend <T>Vec combine(<T>Combiner f, <T>Vec & a, <T>Vec & b); friend <T>Vec reverse(<T>Vec& a); void sort(<T>Comparator f); void apply(<T>Procedure f); <T> reduce(<T>Combiner f, <T> base);};inline <T>Vec concat(<T>Vec& a, <T>Vec& b){return (<T>Vec)concat((VoidPVec&)a, (VoidPVec&)b);}inline <T>Vec map(<T>Mapper f, <T>Vec & a) { return (<T>Vec)map((VoidPMapper)f, (VoidPVec&)a); }inline <T>Vec merge(<T>Vec & a, <T>Vec & b, <T>Comparator f) { return (<T>Vec)merge((VoidPVec&)a, (VoidPVec&)b, (VoidPComparator)f); }inline <T>Vec combine(<T>Combiner f, <T>Vec & a, <T>Vec & b) { return (<T>Vec)combine((VoidPCombiner)f, (VoidPVec&)a, (VoidPVec&)b); }inline <T>Vec reverse(<T>Vec& a) { return (<T>Vec)reverse((VoidPVec&)a);}inline void <T>Vec::sort(<T>Comparator f) { VoidPVec::sort((VoidPComparator) f); }inline void <T>Vec::apply(<T>Procedure f) { VoidPVec::apply((VoidPProcedure) f); }inline <T> <T>Vec::reduce(<T>Combiner f, <T> base) { return (<T>)VoidPVec::reduce((VoidPCombiner)f, base);}#endif /* conditional include */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -