Template parameter names and missing include

Windows defines IN and OUT, so they are no good as template parameter names (see #334 and #361). MSVC also complains about the missing include for set.