MFC中的CList和标准库中的list有关系吗?

YinQingwei1986 2014-05-15 08:28:23
用哪个存储数据比较好?
对MFC的CList理解不够,虽然用过~
...全文
287 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2014-05-16
  • 打赏
  • 举报
回复
CList没有标准库的list好用.... ..它的操作方法也没有这么多 .,
  • 打赏
  • 举报
回复
引用 5 楼 hust_wangyajun 的回复:
确实MFC 固步自封,太狭隘了,做了很多事,却让程序员走进去走不出来。也许是微软太自信了。
像mfc用的比较广泛的库,是只能加不能改的,一旦不兼容旧版本,就会没人用。直到现在很多代码还跟第一版的一样。就算是微软这么NB的公司也没办法,改不了。
YinQingwei1986 2014-05-16
  • 打赏
  • 举报
回复
引用 4 楼 brikehuang 的回复:
自从了解到STL后,就再也没使用过CList等MFC的基础数据结构
谢谢,那MFC的东西像CString等也没string好用了是吗?以前都MFC开发的,标准库用的少~
hust_wangyajun 2014-05-16
  • 打赏
  • 举报
回复
确实MFC 固步自封,太狭隘了,做了很多事,却让程序员走进去走不出来。也许是微软太自信了。
brikehuang 2014-05-16
  • 打赏
  • 举报
回复
自从了解到STL后,就再也没使用过CList等MFC的基础数据结构
kivien 2014-05-15
  • 打赏
  • 举报
回复
template<class T, class A = allocator<T> >
    class list {
public:
    typedef A allocator_type;
    typedef A::size_type size_type;
    typedef A::difference_type difference_type;
    typedef A::reference reference;
    typedef A::const_reference const_reference;
    typedef A::value_type value_type;
    typedef T0 iterator;
    typedef T1 const_iterator;
    typedef reverse_bidirectional_iterator<iterator,
        value_type, reference, A::pointer,
            difference_type> reverse_iterator;
    typedef reverse_bidirectional_iterator<const_iterator,
        value_type, const_reference, A::const_pointer,
             difference_type> const_reverse_iterator;
    explicit list(const A& al = A());
    explicit list(size_type n, const T& v = T(), const A& al = A());
    list(const list& x);
    list(const_iterator first, const_iterator last,
        const A& al = A());
    iterator begin();
    const_iterator begin() const;
    iterator end();
    iterator end() const;
    reverse_iterator rbegin();
    const_reverse_iterator rbegin() const;
    reverse_iterator rend();
    const_reverse_iterator rend() const;
    void resize(size_type n, T x = T());
    size_type size() const;
    size_type max_size() const;
    bool empty() const;
    A get_allocator() const;
    reference front();
    const_reference front() const;
    reference back();
    const_reference back() const;
    void push_front(const T& x);
    void pop_front();
    void push_back(const T& x);
    void pop_back();
    void assign(const_iterator first, const_iterator last);
    void assign(size_type n, const T& x = T());
    iterator insert(iterator it, const T& x = T());
    void insert(iterator it, size_type n, const T& x);
    void insert(iterator it,
        const_iterator first, const_iterator last);
    void insert(iterator it,
        const T *first, const T *last);
    iterator erase(iterator it);
    iterator erase(iterator first, iterator last);
    void clear();
    void swap(list x);
    void splice(iterator it, list& x);
    void splice(iterator it, list& x, iterator first);
    void splice(iterator it, list& x, iterator first, iterator last);
    void remove(const T& x);
    void remove_if(binder2nd<not_equal_to<T> > pr);
    void unique();
    void unique(not_equal_to<T> pr);
    void merge(list& x);
    void merge(list& x, greater<T> pr);
    void sort();
    template<class Pred>
        void sort(greater<T> pr);
    void reverse();
protected:
    A allocator;
    };
template< class TYPE, class ARG_TYPE >
class CList : public CObject

Parameters

TYPE

Type of object stored in the list.

ARG_TYPE

Type used to reference objects stored in the list. Can be a reference.

Remarks

The CList class supports ordered lists of nonunique objects accessible sequentially or by value. CList lists behave like doubly-linked lists. 

A variable of type POSITION is a key for the list. You can use a POSITION variable as an iterator to traverse a list sequentially and as a bookmark to hold a place. A position is not the same as an index, however. 

Element insertion is very fast at the list head, at the tail, and at a known POSITION. A sequential search is necessary to look up an element by value or index. This search can be slow if the list is long.

If you need a dump of individual elements in the list, you must set the depth of the dump context to 1 or greater. 

  • 打赏
  • 举报
回复
没有关系 mfc是92年的,标准库是98年的。

65,208

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧