After my Visual studio 2015 updated from Update 1 to Update 2 my project doesn't compiling. I get an error
'boost::hash_combine': recursive function template definition
boost-1_60\boost\functional\hash\hash_fwd.hpp(25): note: see declaration of 'boost::hash_combine'
Why does it happen?
Removing or moving #include <boost/filesystem.hpp>
from stdafx.h
solved the problem. But how can I don't move it from there?
//stdafx.h
#ifndef STDAFX_H
#define STDAFX_H
#include <map>
#include <vector>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/filesystem.hpp>
#endif
-
//main.cpp
#include "stdafx.h"
class IByteStream
{
public:
explicit IByteStream(const std::string &s)
: _basicArraySource(s.data(), s.size())
, _stream(_basicArraySource)
, _iArchive(_stream)
{
}
template<class T>
IByteStream &operator >> (T &data) { _iArchive >> data; return *this; }
private:
typedef boost::iostreams::basic_array_source<char> BasicArraySource;
typedef boost::iostreams::stream<BasicArraySource> Stream;
typedef boost::archive::binary_iarchive BinaryIArchive;
boost::iostreams::basic_array_source<char> _basicArraySource;
boost::iostreams::stream<BasicArraySource> _stream;
boost::archive::binary_iarchive _iArchive;
};
struct S1
{
template<class Archive>
void serialize(Archive &ar, unsigned) {}
};
struct S2
{
std::map<int, std::map<int, S1>> mp;
template<class Archive>
void serialize(Archive &ar, unsigned) { ar & mp; }
};
struct S3
{
std::vector<S2> v;
template<class Archive>
void serialize(Archive &ar, unsigned) { ar & v; }
};
inline void parse(IByteStream &ibs) {}
template<class T, class... TT>
void parse(IByteStream &ibs, T &t, TT&... tt)
{
ibs >> t;
parse(ibs, tt...);
}
int main()
{
std::string str;
IByteStream ibs(str);
S3 s3;
parse(ibs, s3);
}