Boost logo

Boost :

Subject: Re: [boost] [preprocessor] Get last token
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-28 05:57:57


On Mon, Nov 28, 2011 at 5:18 AM, Roman Perepelitsa
<roman.perepelitsa_at_[hidden]> wrote:
> Is it possible to extract the last token from a list of space separated
> tokens?

AFAIK, it depends. If the preceding tokens are known a priory and do
not contain non-alphanumeric symbols, yes. Otherwise, no.

> LAST_TOKEN(a b)  // expands to b
> LAST_TOKEN(blah blah b)  // expands to b

Yes but only if you know that `a` and `blah blah` are the only tokens
that will ever be in front of b.

> LAST_TOKEN(* & b)  // expands to b

No because * and & are not alphanumeric.

If this is your case, I can reply writing you the macros that can do this.

HTH,
--Lorenzo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk