UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#51 2009-06-19 10:10 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: STL for Tree

if (unused_arg)
    ; /* shut the stupid compiler up! */

Offline

#52 2009-06-19 11:46 PM

jfriesne
Administrator
From: California
Registered: 2005-07-06
Posts: 348
Website

Re: STL for Tree

Offline

#53 2009-06-20 01:52 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: STL for Tree

Offline

#54 2009-06-20 02:11 AM

jfriesne
Administrator
From: California
Registered: 2005-07-06
Posts: 348
Website

Re: STL for Tree

Offline

#55 2009-06-20 02:10 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: STL for Tree

void SomeFunc()
{
    struct MyType blah;
    struct MyType * p;
    struct MyType * t = &blah;
    void * tt;
    struct MyOtherType * ttt = blah.other;

    p = (struct MyType*)ttt; /* programmer error here! */
    p = ttt;   /* same error, but compiler warns about it. */
}


That said, your example does give one situation where forcing a cast would
help avoiding a bug. Void* is useful, but almost never as a separate variable.
It's either part of a structure or a function parameter. This together with
accidentally using the wrong variable makes the whole scenario even less
likely to happen. The above example is as likely to happen. In either case it's
a class of bugs that's very easy to find and fix, because you get a hard crash
when it happens.

Offline

#56 2009-06-20 06:58 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: STL for Tree

Offline

#57 2009-09-08 08:46 AM

dannydesiliva
Guest

Re: STL for Tree

> Is there any STL available for B/B+/B* Tree??or any tree in msvc++?

std::set and std::map are typically implemented as balanced trees -
usually red-black trees. If these are not sufficient for your needs,
you'll have to look for third-party libraries, or roll your own.
--
Igor Tandetnik

Board footer

Powered by FluxBB