help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs function for writing C++ iterator loop


From: Pascal Bourguignon
Subject: Re: emacs function for writing C++ iterator loop
Date: Fri, 29 Jun 2007 09:09:44 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux)

Mohitz <address@hidden> writes:

> I program in C++ using emacs. And i tend to use the C++ iterator a
> lot. Now, whenever I want to iterate I always write almost the same
> kinda code. So, i want to write a emacs function so that emacs does
> that for me.
>
> For example
>
> If i tell emacs that i am iterating on a "deque<ClassName> " variable
> with variable name "var" pointing to
> "someThing", Emacs should potentially be able to generate the
> following
>
> deque<CLassName> var = someThing;
> deque<ClassName>::iterator varIterate;
> varIterate = var.begin();
> while (varIterate != var.end())
> {
>       ClassName tempClassName;
>       tempClassName = *varIterate;
>
>       //Do something with tempClassName
>
>       varIterate++;
> }
>
> Any kind of help or pointers to help material would be greatly
> appreciated

Perhaps better than skeleton mode, use emacs as a C/C++ preprocessor:

http://www.xcf.berkeley.edu/~ali/elpp/elpp.el
http://www.xcf.berkeley.edu/~ali/elpp/elppc.el
http://www.xcf.berkeley.edu/~ali/elpp/cgen.el

Basically it allows you to insert elisp in your c code and to
autogenerate c code from elisp s-expressions.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]