I'm reading post "64bit" on The AdaptiveRisk Blog, where the sample code has a line can't be compiled in visual studio 2013:
/*!
@brief Helper to determine whether there's a key_type for T.
@sa http://ift.tt/2suequp
*/
template<typename T>
struct has_mapped_type
{
private:
template<typename C> static char test(typename C::mapped_type*);
template<typename C> static char(&test(...))[2];
public:
static constexpr bool value = sizeof(test<T>(0)) == 1;
};
Here static constexpr bool value = sizeof(test<T>(0)) == 1;
using constexpr could not be compiled. Simply removing constexpr
doesn't work, VS reports error C2864:
'nlohmann::`anonymous-namespace'::has_mapped_type::value' : a static data member with an in-class initializer must have non-volatile const integral type
Is there a way to rephrase it so that VS 2013 could compile?
Aucun commentaire:
Enregistrer un commentaire