Covariant C++库
c4droid吧
全部回复
仅看楼主
level 13
李登淳 楼主
[不高兴]吞吞相报何时了…
不说闲话。
包括:
一系列好玩的可以替代printf的高效智能print函数
cov::genericType泛型,基础类型放心去用呗,不需要担心啥类型。类型什么的都不是事~
cov::handler智能指针,把资源交给我,我帮你打理。效率高,还不用担心内存泄露和那堆的内存错误。
cov::timer高精度计时器,精度高达纳秒,麻麻再也不用担心程序计时了
@DXKite @_柒月初七 @ljt12138 @九尾沧海忆 @1421126961
别再吞了!我没打广告!
2016年02月18日 09点02分 1
level 13
李登淳 楼主
持续更新!会加入更多好玩的东西,只要你想要!
2016年02月18日 09点02分 2
下载地址在这里
2016年02月18日 09点02分
2016年04月19日 08点04分
level 13
李登淳 楼主
吞吞相报没个完啊…度娘也是够了…
2016年02月18日 09点02分 3
level 10
怎么用[滑稽]
2016年02月18日 10点02分 4
using namespace cov; clocks.delay(clocks::timeUnit::milliSec,10);
2016年02月18日 11点02分
timeUnit: nanoSec:纳秒 microSec:微秒 milliSec:毫秒 second:秒 minute:分
2016年02月18日 11点02分
@李登淳 谢谢[滑稽]
2016年02月18日 12点02分
@急急急传冠哥 为什么总是滑稽[滑稽]
2016年02月18日 12点02分
level 12
围观[滑稽]
目测技术是追不上
lz
了。。。。。
不过我也不会封装。。。。。
管他呢,反正我准备鼓捣算法去[滑稽]
魅族
2016年02月18日 12点02分 5
别入算法坑啊…那玩意会毁了你的
2016年02月18日 12点02分
回复 李登淳 :其实我去学web渗透了[乖][滑稽]越来越不务正业。。。[惊哭]
2016年02月18日 14点02分
@2002a1116 [狂汗]好好学C/C++不行?
2016年02月18日 14点02分
web?php么?
2016年02月18日 23点02分
level 10
getch貌似有延迟[喷]
2016年02月18日 13点02分 7
啥?我用的termios
2016年02月18日 14点02分
level 13
[阴险]libkoll不服
2016年02月18日 15点02分 8
你写的?
2016年02月19日 00点02分
@李登淳 当然[滑稽]
2016年02月19日 03点02分
2016年02月19日 03点02分
2016年02月19日 03点02分
level 11
楼主,我要一封装的链表......
我装的貌似内存溢出
成员函数:
inline void add(T newContent);
inline void add(T newContent, unsigned int index);
inline void star();
inline bool next();
inline bool end();
inline T & operator [] (unsigned int index);
inline T & last();
inline T & at(unsigned int index);
inline T & at();
inline bool remove(unsigned int index);
inline bool remove();
inline void clear();
inline int Sum();
inline int Index();
2016年02月18日 16点02分 9
你这…一堆inline干嘛的…而且加个注释行不行?
2016年02月19日 00点02分
level 13
李登淳 楼主
// @丿小夕ve
template < typename InType, typename T = cov::handler < InType > >class cov::list
{
protected:
class node
{
friend class list;
friend class iterator;
T data;
node *front = 0;
node *behind = 0;
};
public:
class iterator
{
friend class list;
protected:
node * me;
public:
iterator():me(0)
{
}
iterator(node * ptr):me(ptr)
{
}
iterator(const iterator &) = default;
operator bool() const
{
return me;
}
T & operator*() const
{
if (me)
return me->data;
}
T *operator->() const
{
if (me)
return &me->data;
}
iterator & operator++()
{
me = me->behind;
return *this;
}
iterator & operator--()
{
me = me->front;
return *this;
}
bool operator==(const iterator & obj)
{
return me == obj.me;
}
bool operator!=(const iterator & obj)
{
return me != obj.me;
}
};
protected:
node * m_head;
node *m_end;
long m_size = 0;
public:
list():m_head(0), m_end(0)
{
}
list(const list & in);
~list();
void clear();
const list & operator=(const list & in);
void push_front(const T & obj);
void push_back(const T & obj);
void pop_front();
void pop_back();
void insert(iterator it, const T & obj);
void erase(iterator & it);
void remove(const T & obj);
long size() const
{
return m_size;
}
iterator head()
{
return list < InType, T >::iterator(m_head);
}
iterator tail()
{
return list < InType, T >::iterator(m_end);
}
};
2016年02月19日 00点02分 10
单向就行了, 迭代器什么的都不用了 尽量简单高效, 能实现常用的就ok了 函数小于5行我就会用inline 我习惯了用list..表示顺序储存的
2016年02月19日 01点02分
@丿小夕ve 你不用迭代器怎么访问?
2016年02月19日 01点02分
回复 李登淳 :不是...不用固定迭代器,用临时的就ok
2016年02月19日 01点02分
@丿小夕ve 你怎么用临时的?你反不能构造一个右值引用吧?for(auto it=lst.head;it;++it)
2016年02月19日 01点02分
level 9
文件复制那个应该可以改进一下,理论缓存对缓存的copy理论会快一点,当然也许我是错误的
2016年02月19日 01点02分 11
[呵呵]这个函数是直接从OSC上Copy下来的
2016年02月19日 01点02分
level 11
template < typename T > class Chain {
protected:
unsigned int index = 0, sum = 0;
/*记录下标和总数*/
struct Unit {
T content;
Unit *next;
} *head = NULL, *tail = NULL, *position = head;
/*每一个节点(先叫节点吧)*/
public:
Chain();
~Chain();
inline void add(T newContent);
/*末尾添加*/
inline void add(T newContent, unsigned int index);
/*添加到第index个*/
inline void star();/*position指向第一个节点*/
inline bool next();/*position移向下一个节点*/
inline bool end();;/*判断position到达尾节点*/
inline T & at();/*获取当前position节点内容*/
inline int Index();/*返回当前position下标*/
inline bool remove();/*删除当前position节点*/
inline T & operator [] (unsigned int index);/*获第index个的内容*/
inline T & last();/*获最后一个的内容*/
inline T & at(unsigned int index);/*获第index个的内容*/
inline bool remove(unsigned int index);/*删除第index个的节点*/
inline void clear();/*删除全部*/
inline int Sum();/*返回总数*/
};
poition,没太大关系;
是固定储当前位置,每次访问直接取,用next()才后移,
因为很多情况是不用下标的,才设了这个
效率约是用[index]的2倍
at(index)和[index]是差不多的,
2016年02月19日 01点02分 12
不太合理。迭代器直接安在数据上不太好。
2016年02月19日 01点02分
回复 李登淳 :.....就是用[100]访问完这一次,下次[100]又要从head开始....
2016年02月19日 02点02分
@丿小夕ve 不合理
2016年02月19日 02点02分
level 13
最近在研究可以用来装X的 C++ Name Mangling。
extern "C++" void *foo(void *);
extern "C" void *_Z3fooPv(void *);
上面的两个声明在 GNU 环境下指向的是同一个函数。
2016年02月23日 04点02分 14
[滑稽]这X装的。我刚实现了任意类型的switch
2016年02月23日 05点02分
@李登淳 你确定?
2016年02月23日 05点02分
@Wiseluster 我很确定。只是不支持嵌套罢了
2016年02月23日 05点02分
@Wiseluster 不能嵌套switch…
2016年02月23日 10点02分
level 13
李登淳 楼主
Boom!重磅炸弹
@Wiseluster @九尾沧海忆 @ljt12138 @_柒月初七 @DXKite
已经实现支持任意类型的switch
2016年02月23日 05点02分 15
二楼下载地址
2016年02月23日 05点02分
boom...阿鲁巴
2016年02月23日 09点02分
level 13
李登淳 楼主
这回我要无耻地申精了[阴险]
@傻傻_痴痴 @洋蛋炒饭
2016年02月23日 05点02分 16
level 10
[惊讶]二进制文件吗,我还以为是源码[滑稽]
2016年02月23日 06点02分 17
源码…你打开看看
2016年02月23日 10点02分
@李登淳 [滑稽]打开后正常
2016年02月24日 00点02分
@九尾沧海忆 [滑稽]那就对了
2016年02月24日 00点02分

2016年07月23日 21点07分
1 2 3 4 5 尾页