mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
I.30: use const c-string to pass filename and input string in example (#2140)
to signal that they will not modified
This commit is contained in:
@@ -2310,8 +2310,8 @@ So, we write a class
|
|||||||
public:
|
public:
|
||||||
enum Opt { from_line = 1 };
|
enum Opt { from_line = 1 };
|
||||||
Istream() { }
|
Istream() { }
|
||||||
Istream(zstring p) : owned{true}, inp{new ifstream{p}} {} // read from file
|
Istream(czstring p) : owned{true}, inp{new ifstream{p}} {} // read from file
|
||||||
Istream(zstring p, Opt) : owned{true}, inp{new istringstream{p}} {} // read from command line
|
Istream(czstring p, Opt) : owned{true}, inp{new istringstream{p}} {} // read from command line
|
||||||
~Istream() { if (owned) delete inp; }
|
~Istream() { if (owned) delete inp; }
|
||||||
operator istream&() { return *inp; }
|
operator istream&() { return *inp; }
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user