יום שני, אוגוסט 23, 2010

wtf?

The problem was that back_inserter() was used without including <iterator>. The C++ Standard Library headers include one another in unspecified ways. "Unspecified" means that the Standard allows but doesn't require any header X to include any header Y. Furthermore, implementations (like Visual C++) aren't required to document what they do, and are allowed to change what they do from version to version (or according to the phase of the moon, or anything else). That's what happened here. In VC9 SP1, including <algorithm> dragged in <iterator>. In VC10 Beta 1, <algorithm> doesn't drag in <iterator>.

When you use a C++ Standard Library component, you should be careful to include its header (i.e. the header that the Standard says it's supposed to live in). This makes your code portable and immune to implementation changes like this one.

call me crazy but when I use software product I expect it to be consistent between different versions. isn't it the idea behind standardized software. ?

אין תגובות:

הוסף רשומת תגובה