Home » Community » U++ community news and announcements » MakeOne
Re: MakeOne [message #47650 is a reply to message #47649] |
Tue, 21 February 2017 16:05 |
|
mirek
Messages: 13976 Registered: November 2005
|
Ultimate Member |
|
|
Klugier wrote on Tue, 21 February 2017 12:14Hello,
I have got one question. Will it work with auto?
auto stream = MakeOne<FileIn>(fn); // Is auot MakeOne or One?
Sure. It will be MakeOne, but that hardly matters.
{
auto in = MakeOne<FileIn>(GetDataFile("Console.cpp"));
One<Stream> s = pick(in);
while(!s->IsEof())
DDUMP(s->GetLine());
}
Quote:
Why not make MakeOne function rather than class?
Class seems to be more versatile here - you can use it just like function, but you can declare the variable too.
E.g. you can do this:
One<Stream> OpenFile()
{
MakeOne<FileIn> in;
in->Open("asd");
return in;
}
With "function only" you would have to type a bit more...
Mirek
[Updated on: Tue, 21 February 2017 16:07] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri May 10 07:50:34 CEST 2024
Total time taken to generate the page: 0.01627 seconds
|