Re:Variadic function can have type safety.

Discussion in 'C++' started by Heribert Weinrot, Dec 23, 2012.

  1. If you use proper C++ there are several ways of handing over a variable
    list of arguments to an object/method. See this example:

    Logger l;
    l.print("The price of $ is $ at $").sa("wheat").sa(16.66).sa("Monday,
    17th, August 2011");

    The trick here is that print() and sa() return the Logger object, so that
    you can have a nice syntax. I did this with great success.
     
    Heribert Weinrot, Dec 23, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Walters
    Replies:
    2
    Views:
    528
    Ben Pfaff
    Feb 13, 2004
  2. Ross A. Finlayson
    Replies:
    19
    Views:
    607
    Keith Thompson
    Mar 10, 2005
  3. Replies:
    2
    Views:
    355
    Dave Thompson
    Feb 27, 2006
  4. Replies:
    5
    Views:
    368
  5. Nephi Immortal

    Variadic function can have type safety.

    Nephi Immortal, Dec 20, 2012, in forum: C++
    Replies:
    0
    Views:
    297
    Nephi Immortal
    Dec 20, 2012
Loading...

Share This Page