C++ – boost::array not compiling on VS 2005


Sorry this is probably a stupid question, as I couldn't find anything at all on google on the subject. Anyways I'm trying to compile some source code, that uses boost::array with visual studio 2005, as a Win32 console application (not clr), however for some reason that escapes me Visual Studio still considers the word array a keyword, so it chokes on all the boost::array<>'s in the code with errors like this:

Error   1   error C2039: 'array' : is not a member of 'boost'
d:\projects\libraries\boost_1_36_0-1\boost_1_36_0\boost\asio\buffer.hpp 809

I'm quite sure there is something terribly stupid and probably obvious I'm missing as no one in the world seems to have this problem (according to Google's results I found)

Best Solution

This simple program compiled and worked perfectly in my VC++ 2005:

#include <iostream>
#include <boost/array.hpp>

     const int size = 3;
     boost::array<double,size> myArray;
     myArray[0] = 23.43f;
     myArray[1] = 24.00f;
     myArray[2] = 23.50f;
     double sum = 0.0;
     for (size_t i = 0; i < myArray.size(); ++i) 
         sum += myArray[i];
     std::cout << "sum=" << sum << '\n';
     return 0;

Could you post a small code snippet that fails?