Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   Gnucleus (Windows) (https://www.gnutellaforums.com/gnucleus-windows/)
-   -   Question on Gnucleus sockets, STL (https://www.gnutellaforums.com/gnucleus-windows/14641-question-gnucleus-sockets-stl.html)

Kaom August 19th, 2002 03:45 AM

Question on Gnucleus sockets, STL
 
Why does Gnucleus use in class CGnuControl
std::vector<CGnuNode*> m_NodeList; instead of
std::list<CGnuNode*> m_NodeList; ?

Wouldn't a std::list behave more efficient when deleting random socket objects? AFAIK the server has insertion always to end, the deletion is at random positions, access is serially. A std::list fits better? *asking*

2nd question, in class CChatRoom should't
std::vector<CString> m_UserList; be a
std::map<CString, int> m_UserList; (or similar)?

An implementation of CChatRoom::FindUser() could then be more simple?

Thanks for feedback.

Unregistered August 19th, 2002 08:06 AM

Kaom
 
In CGnuControl::~CGnuControl() you don't need to:
delete m_NodeList.back();
m_NodeList.pop_back();


First line is fine, but the pop_back() is not necesarry IMHO. Just destroy your objects, then at the end of the dtor the vector's memory is released and destroyed (any access on non existing socket objects can't happen).

Am I telling ****?

Kaom August 20th, 2002 12:08 PM

and If you don't dare to use std:map with MSVC use:
#pragma warning(disable: 4786) // aka identifier was truncated to 'number' characters in debug information


All times are GMT -7. The time now is 06:47 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.