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:
Shaun Ruffell 2019-12-23 04:16:47 -06:00 committed by lauft
parent ff56bc4759
commit ea3bbd0e85
2 changed files with 2 additions and 2 deletions

View file

@ -77,7 +77,7 @@ std::string Datafile::lastLine ()
}
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string> Datafile::allLines ()
const std::vector <std::string>& Datafile::allLines ()
{
if (! _lines_loaded)
load_lines ();

View file

@ -41,7 +41,7 @@ public:
std::string name () const;
std::string lastLine ();
std::vector <std::string> allLines ();
const std::vector <std::string>& allLines ();
void addInterval (const Interval&);
void deleteInterval (const Interval&);