Upgraded code to switch to C++17. Tested on Debian Buster

This commit is contained in:
emeric
2019-09-10 13:07:06 +02:00
parent 178c400067
commit 2c5917235a
82 changed files with 723 additions and 755 deletions
+3 -3
View File
@@ -8,14 +8,14 @@ som_SOURCES = \
$(top_srcdir)/src/similarity/features/som/DataNormalizer.cpp \
$(top_srcdir)/src/similarity/features/som/Network.cpp
som_CXXFLAGS=-std=c++14 -Wall -I${top_srcdir}/src/ -I${top_srcdir}/src/similarity/features/som/
som_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/ -I${top_srcdir}/src/similarity/features/som/
database_SOURCES = \
$(srcdir)/database/DatabaseTest.cpp \
$(top_srcdir)/src/database/Artist.cpp \
$(top_srcdir)/src/database/Cluster.cpp \
$(top_srcdir)/src/database/Database.cpp \
$(top_srcdir)/src/database/Db.cpp \
$(top_srcdir)/src/database/TrackArtistLink.cpp \
$(top_srcdir)/src/database/TrackFeatures.cpp \
$(top_srcdir)/src/database/TrackList.cpp \
@@ -29,5 +29,5 @@ database_SOURCES = \
$(top_srcdir)/src/utils/Logger.cpp \
$(top_srcdir)/src/utils/Utils.cpp
database_CXXFLAGS=-std=c++14 -Wall -I${top_srcdir}/src/
database_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/
+8 -8
View File
@@ -19,11 +19,11 @@
#include <cstdlib>
#include <boost/filesystem.hpp>
#include <filesystem>
#include "database/Artist.hpp"
#include "database/Cluster.hpp"
#include "database/Database.hpp"
#include "database/Db.hpp"
#include "database/TrackList.hpp"
#include "database/Release.hpp"
#include "database/Track.hpp"
@@ -34,10 +34,10 @@ using namespace Database;
class ScopedFileDeleter final
{
public:
ScopedFileDeleter(const boost::filesystem::path& path) : _path {path} {}
~ScopedFileDeleter() { boost::filesystem::remove(_path); }
ScopedFileDeleter(const std::filesystem::path& path) : _path {path} {}
~ScopedFileDeleter() { std::filesystem::remove(_path); }
private:
boost::filesystem::path _path;
std::filesystem::path _path;
};
#define CHECK(PRED) \
@@ -1247,19 +1247,19 @@ testDatabaseEmpty(Session& session)
CHECK(Track::getAll(session).empty());
}
int main(int argc, char* argv[])
int main()
{
try
{
const boost::filesystem::path tmpFile {boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()};
const std::filesystem::path tmpFile {std::tmpnam(nullptr)};
ScopedFileDeleter tmpFileDeleter {tmpFile};
std::cout << "Database test file: '" << tmpFile.string() << "'" << std::endl;
for (std::size_t i = 0; i < 2; ++i)
{
Database::Database db {tmpFile};
Database::Db db {tmpFile};
std::unique_ptr<Session> session {db.createSession()};
auto runTest = [&session](const std::string& name, std::function<void(Session&)> testFunc)
+1 -1
View File
@@ -26,7 +26,7 @@
using namespace SOM;
int main(int argc, char* argv[])
int main()
{
static const InputVector::value_type EPSILON = 0.01;
{