Visual Studio 2013 compilation fixes.

- Missing header file callouts in some cases (library deltas)
- Lack of support for auto parameters in lambdas
- Defining of ERROR by windows.h
- Dispatcher::Connection needs a move constructor (default not generated)
- Need explicit enable_if on std::string move template in Value to avoid trying to move const char[] (string literal)
- Compile flags
This commit is contained in:
Peter Johnson
2015-08-03 01:23:42 -07:00
parent a86f65db1e
commit 4146db6fc8
9 changed files with 21 additions and 7 deletions

View File

@@ -85,6 +85,13 @@ class DispatcherBase {
Connection() = default;
explicit Connection(std::unique_ptr<NetworkConnection> net_)
: net(std::move(net_)) {}
Connection(Connection&& rhs) {
net = std::move(rhs.net);
outgoing = std::move(rhs.outgoing);
last_update = std::move(rhs.last_update);
}
Connection(const Connection&) = delete;
Connection& operator=(const Connection&) = delete;
void QueueOutgoing(std::shared_ptr<Message> msg);
std::unique_ptr<NetworkConnection> net;

View File

@@ -60,6 +60,7 @@ class Logger {
} \
} while (0)
#undef ERROR
#define ERROR(x) LOG(NT_LOG_ERROR, x)
#define WARNING(x) LOG(NT_LOG_WARNING, x)
#define INFO(x) LOG(NT_LOG_INFO, x)

View File

@@ -7,6 +7,7 @@
#include "Storage.h"
#include <cctype>
#include <string>
#include <tuple>
@@ -567,7 +568,8 @@ static void WriteString(std::ostream& os, llvm::StringRef str) {
void Storage::SavePersistent(std::ostream& os) const {
// copy values out of storage as quickly as possible so lock isn't held
std::vector<std::pair<std::string, std::shared_ptr<Value>>> entries;
typedef std::pair<std::string, std::shared_ptr<Value>> NewEntry;
std::vector<NewEntry> entries;
{
std::lock_guard<std::mutex> lock(m_mutex);
entries.reserve(m_entries.size());
@@ -581,7 +583,7 @@ void Storage::SavePersistent(std::ostream& os) const {
// sort in name order
std::sort(entries.begin(), entries.end(),
[](const auto& a, const auto& b) { return a.first < b.first; });
[](const NewEntry& a, const NewEntry& b) { return a.first < b.first; });
std::string base64_encoded;

View File

@@ -92,7 +92,7 @@ void NetworkTable::AddTableListener(StringRef key,
void NetworkTable::RemoveTableListener(ITableListener* listener) {
auto matches_begin =
std::remove_if(m_listeners.begin(), m_listeners.end(),
[=](const auto& x) { return x.first == listener; });
[=](const Listener& x) { return x.first == listener; });
for (auto i = matches_begin; i != m_listeners.end(); ++i)
nt::RemoveEntryListener(i->second);