Boost logo

Boost :

Subject: Re: [boost] [preprocessor] Get last token
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2011-11-28 06:28:09

2011/11/28 Lorenzo Caminiti <lorcaminiti_at_[hidden]>

> 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.

Thanks for the reply, Lorenzo.

Tokens can be anything in my case. I'll change the API of my macro to avoid
the need for LAST_TOKEN.

Roman Perepelitsa.

Boost list run by bdawes at, gregod at, cpdaniel at, john at