Creating a searchable collection of rooms
There are some issues here:

  auto room = rooms.GetRoom(0);


Here you do copy the Room because auto does not imitate the 'reference part'. To bind a reference to the internal map entry, you need to both return by reference and assign to a reference type. Based on your gist, I assume you would think that if you then call room.OnEnter, the Room is also updated in the RoomList. This is not the case, because it is a copy. Therefore you would want to use:

  auto&amp; room = rooms.GetRoom(0);


instead. But for that to work, RoomList::GetRoom should return a non-const reference, so that you can actually modify it. In turn there should also be a const RoomList::GetRoom that also returns a const reference.

However, there should also be a non-const RoomList::GetRoom that returns a non-const reference, so that you can actually call non-const methods on the returned rooms.

To avoid running into that issue - you might want to delete the copy constructors and assignment operators of Room. If you further wanted to enforce that all Room objects are owned only by RoomList you could even make the Room constructor private and friend RoomList.


  I'm not initializing the m_rooms map - will it be default initialized to live as long as the rooms variable in main.cpp is in scope?


Yes


  I have a map of Rooms, but I want to return Room references. Will returning a Room have any negative side effects? (e.g., is there some automatic creation of a wrapper object or even a copy of Room going on?)


Not for std::map. You can delete the copy constructor and assignment operator or Room, that will ensure you make no copies somewhere else in the code also.

See https://stackoverflow.com/a/6442829/620382 for a listing of iterator/reference invalidations in standard containers.


  Is result-&gt;second even still valid after a return? result is a local variable that should die when the function ends, but I'm returning what second points to, so that should be good?


Yes. result points to the internal value_type of the map.


  Would I need to implement ~RoomList to make sure all the Rooms are freed? Or does std::map::emplace own the constructed Room?


RoomList::m_rooms own the constructed Rooms. More technically speaking:

m_rooms.emplace(0, Room(0, "Start Room"));

Here a temporary Room object is created, which is then moved into the std::pair&lt;int, Room&gt; that is construed inside of the map. In C++14 you can use std::piecewise_construct to even skip the temporary Room object. But as long as you have a move constructor, which you have by default, you are fine.


  If I wanted to return something by value, how would I need to allocate it? For example, imagine I've added this to Room, wouldn't I return a stack-allocated variable?


If you do not declare the return value to be a reference (which you do not in your example), then it is returned by copy. But the C++ rules and compilers are good so that you will either get a move (cheaper than actual copy) or even omitting it alltogether when possible.


  // Considering Optional


If you document it properly, it would be actually fine to return a raw pointer here, with nullptr meaning that it is not available. The raw pointer (similar to the raw reference) does not imply ownership. You just need to make sure the caller does never reference it without checking. optional (also available in boost and soon in the standard).

The funny thing about your code is, that you have randomly written proper and safe code. IMHO this is a nice property especially about modern C++. There is actually no explicit resource allocation (like new) in your code - when you allocate resources implicitly, through member variables, C++ will behave nicely by default and also implicitly release the resources.

  std::string m_name; // should this be const?
  int m_id; // should this be const?


Yes, it would be a good idea to make those const.

const int&amp; GetEnterCount() const { return m_enterCount; };


I would consider it a uncommon to return an int by const reference here (as opposed to a simple copy). I don't have a strong argument for or against, but lets just take note that std::vector::size doesn't return an const int&amp; either.

  RoomList&amp; operator=(RoomList const&amp;) = delete;


You should put the const before RoomList for consistency.
You also might want to explicitly default or delete the move constructor and assignment operators. I would say neither would hurt.

In Room, you list m_id and m_name in a different order in the initializer list. This can lead to confusion because the initialization order follows the order from member declaration (m_name then m_id). Therefore this is a compiler warning.

So the tip is, compile with maximal warnings, e.g. -Wall -pedantic for gcc. Also it can be helpful to run your code with valgrind to check for any leaks.