macro question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • abir

    macro question

    Hi,
    this is not related to strict c++ , but macro.
    I want a statement to be generated like
    std::size_t count = sizeof(trace2)/sizeof(coord_t) ;
    for (std::size_t i = 0; i< count; i += 2){
    std::cout<<trac e2[i]<<" "<<trace2[i+1]<<std::endl;
    }

    when i write LOAD_TOKEN(2)

    so the main problem is to essentially catenate "token" with a token
    id.
    I am looking at ##, but in between something fails to compile.
    thanks
    abir
  • Tom

    #2
    Re: macro question

    On 12 Mrz., 08:31, abir <abirba...@gmai l.comwrote:
    Hi,
    so the main problem is to essentially catenate "token" with a token
    id.
    I am looking at ##, but in between something fails to compile.
    Usually it works like this:

    #define LOAD_TOKEN(n) ....token##n... .

    where "..." has to be your code, of course.

    Thomas
    ---------------------
    Elimina Outlook Duplicados: http://www.easy2sync.com/es/produkte...te-Outlook.php

    Comment

    Working...