Use standard map.

This commit is contained in:
Nicolás Ortega Froysa 2017-09-25 12:21:32 +02:00
parent b330df5a8d
commit b4544a79fe
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 8 additions and 5 deletions

View File

@ -21,7 +21,7 @@
#include "error.hpp"
#include "globals.hpp"
std::unordered_map<std::string, struct channel_info> channels;
std::map<std::string, struct channel_info> channels;
int NeoComm_join_channel(const char *channel_name) {
if(not node.isRunning())
@ -82,8 +82,11 @@ struct message *NeoComm_get_next_message(const char *channel_name) {
struct message *msg =
static_cast<struct message*>(malloc(sizeof(struct message)));
msg->msg = new_msg->msg.c_str();
*msg = {
/*.msg =*/ new_msg->msg.c_str(),
/*.sent =*/ new_msg->date,
// TODO: add the rest of these
};
return msg;
}

View File

@ -19,7 +19,7 @@
#pragma once
#include <opendht.h>
#include <unordered_map>
#include <map>
#include <vector>
#include <string>
#include <utility>
@ -34,4 +34,4 @@ struct channel_info {
extern dht::DhtRunner node;
// the key element is the name of the channel
extern std::unordered_map<std::string, struct channel_info> channels;
extern std::map<std::string, struct channel_info> channels;