Skip to content

Commit

Permalink
MSVC2013 doesn't support unrestricted unions. UTTER HACK: use a struc…
Browse files Browse the repository at this point in the history
…t instead of a union. This could be fixed properly by placement constructing into a raw buffer stored in the union.
  • Loading branch information
RossBencina committed May 24, 2015
1 parent 94de11e commit 87e163f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2362,7 +2362,15 @@ class basic_json
///////////////

/// an iterator value
union internal_iterator
#ifndef _MSC_VER
union
#else
// MSVC doesn't support unrestricted unions.
// http://stackoverflow.com/questions/30417121/is-it-legal-to-store-an-stl-iterator-inside-a-union/30417415#30417415
// This could be worked-around using placement new into buffer.
struct // HACK
#endif
internal_iterator
{
/// iterator for JSON objects
typename object_t::iterator object_iterator;
Expand Down

0 comments on commit 87e163f

Please sign in to comment.