Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6068 closed Bugs (invalid)

Serialization doesn't work with strongly typed enum

Reported by: Tommi Tissari <tommitissari@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.47.0 Severity: Problem
Keywords: serialization enum Cc:

Description

I guess the summary basically says it all. I'm using Intel c++ composer XE 2011 (update 6).

Change History (2)

comment:1 by Robert Ramey, 11 years ago

Resolution: invalid
Status: newclosed

I don't know what you mean by a "strongly typed enum". If you want to post a small sample I'll have a look at it. But until that happens there's nothing I can do.

Robert Ramey

in reply to:  1 comment:2 by tommitissari@…, 11 years ago

Replying to ramey:

I don't know what you mean by a "strongly typed enum". If you want to post a small sample I'll have a look at it. But until that happens there's nothing I can do.

Robert Ramey


I mean the new C++11 strongly typed enumeration as described here:
http://en.wikipedia.org/wiki/C%2B%2B11#Strongly_typed_enumerations

Compiling the following gives the error:
C:\Boost\include\boost-1_47\boost/serialization/access.hpp(118): error : expression must have class type

enum class MyEnum { first, second, third };
MyEnum myenum = MyEnum::second;

std::ofstream file( _T("serialized_enum"), std::ios::out | std::ios::binary );
boost::archive::binary_oarchive outArchive( file );

outArchive << myenum;
file.close();
Note: See TracTickets for help on using tickets.