mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Datafile: allLines() can return const reference instead of copy.
Not only does this eliminate the need to copy the stings to the caller, it will also eliminate the need for any iterators over the entries in the Database from having to hold a copy of the lines from the Datafile. Related to #245.
This commit is contained in:
parent
ff56bc4759
commit
ea3bbd0e85
2 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ std::string Datafile::lastLine ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <std::string> Datafile::allLines ()
|
const std::vector <std::string>& Datafile::allLines ()
|
||||||
{
|
{
|
||||||
if (! _lines_loaded)
|
if (! _lines_loaded)
|
||||||
load_lines ();
|
load_lines ();
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
std::string name () const;
|
std::string name () const;
|
||||||
|
|
||||||
std::string lastLine ();
|
std::string lastLine ();
|
||||||
std::vector <std::string> allLines ();
|
const std::vector <std::string>& allLines ();
|
||||||
|
|
||||||
void addInterval (const Interval&);
|
void addInterval (const Interval&);
|
||||||
void deleteInterval (const Interval&);
|
void deleteInterval (const Interval&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue