Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2007 17:19:19 +0000 (UTC)
From:      Marcin Wisnicki <mwisnicki+freebsd@gmail.com>
To:        freebsd-arch@freebsd.org
Subject:   Re: C++ in the kernel
Message-ID:  <fgaden$ou5$1@ger.gmane.org>
References:  <9bbcef730710300648s4a4162a9x25e5a092111eaab9@mail.gmail.com> <2979.1193779624@critter.freebsd.dk> <9bbcef730710301519p2931006aq5ba3a94fa1cc67c5@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Oct 2007 23:19:50 +0100, Ivan Voras wrote:
> Re: C++: This:
> 
> for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
> 
> still looks pretty ugly but at least it's known to almost any CS/IT
> undergrad out there.
> 
> My personal choice of a "C++ done right" language is D, it has this
> variant:
> 
> foreach(i, a; args)
>     writefln("args[%d] = '%s'", i, a);

You can do something like this in c++, for example with boost::foreach:

#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH

foreach(int i, v) {
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fgaden$ou5$1>