project(NetRadiant C CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+# For some reason the above flags don't really work...
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag(--std=c++${CMAKE_CXX_STANDARD} STD_CXX)
+ if(STD_CXX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++${CMAKE_CXX_STANDARD}")
+ else()
+ message(SEND_ERROR "Requires C++${CMAKE_CXX_STANDARD} or better")
+ endif()
+else()
+ message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}, make sure it supports C++${CMAKE_CXX_STANDARD}")
+endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
add_library(string
libs/string/pooledstring.cpp
libs/string/pooledstring.h
- libs/string/string.cpp
libs/string/string.h
- libs/string/stringfwd.cpp
- libs/string/stringfwd.h
)
add_library(xml
typedef HashTable<std::string, int, HashString> MyHashTable;
MyHashTable hashtable;
hashtable["bleh"] = 5;
- hashtable.insert( "blah", 17 );
+ hashtable.insert({"blah", 17});
hashtable["foo"] = 99;
- hashtable.insert( "bar", 23 );
+ hashtable.insert({"bar", 23});
- int bleh = ( *hashtable.find( "bleh" ) ).value; // 5
+ int bleh = ( *hashtable.find( "bleh" ) ).second; // 5
int blah = hashtable["blah"]; // 17
hashtable.erase( "foo" );
MyHashTable::iterator barIter = hashtable.find( "bar" );
#define INCLUDED_CONTAINER_HASHTABLE_H
#include <unordered_map>
+#include "debugging/debugging.h"
template<typename Key, typename Value, typename Hasher, typename KeyEqual = std::equal_to<Key> >
using HashTable = std::unordered_map<Key, Value, Hasher, KeyEqual>;