Windows accepts both forward- and backslash as path separator. At least since Windows XP.
I cannot read minds, but I could guess that forward slash was used in the name of (potential) portability and/or standards compliance because backslash in an include directive has undefined behaviour in c++03.
c++03 §2.8/2:
If either of the characters ’ or \, or either of the character sequences /* or // appears in a q-char-sequence or a h-char-sequence, or the character " appears in a h-char-sequence, the behavior is undefined.
The wording was changed in c++11 according to the draft. The behaviour is no longer undefined, but still implementation defined.
c++11 draft §2.9/2
The appearance of either of the characters ’ or \ or of either of the character sequences /* or // in a
q-char-sequence or an h-char-sequence is conditionally supported with implementation-defined semantics, as
is the appearance of the character " in an h-char-sequence.
About your bug:
If I change the path to #include "..\this\thread.hpp" it finds the file
Pay close attention to your two different include directives. There's more difference than the path separator. Firstly, the forward slash version doesn't refer to parent path (../
), secondly the path is enclosed in < >
which is wrong in this case since it appears that the path is intended to be relative to the current file. See https://stackoverflow.com/a/21594/2079303 for more details.