TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JEAN-POL LANDRAIN
from: JERRY COFFIN
date: 1997-03-17 19:06:00
subject: C++ Formatted Output

On (16 Mar 97) Jean-Pol Landrain wrote to Jerry Coffin...
[ wanting to write a manipulator with two parameters ]
 JL> With BC++.
 JL> I remember wich macro I have to use for a manipulator with one
 JL> parameter, but I can't remember how to do with two parameters.
Just FWIW, recent versions of BC++ use templates instead of macros.
However, since you say you're using macros, I'll do a macro based one.
The general idea is to create a class that holds both (or all three, or
whatever) of the arguments, so you can pass them as a single parameter
to the manipulator proper.  You then create a front-end function that
takes the correct number of parameters, and creates an object out of
them, and passes that along to the real manipulator:
For demo purposes, I'll do a manipulator to print a specified number of
lines filled to a specifed width with a specified character:
#include 
class line_filler {
    char ch;
    int width;
    int lines;
public:
    line_filler(char ch_ = 0, int width_ = 0, int lines_ = 0) :
        ch(ch_), width(width_), lines(lines_) {}
    static ostream &do_fill(ostream &stream, line_filler param) {
	    for ( int i=0;i * Origin: Point Pointedly Pointless (1:128/166.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.