Small problem with boost serialize macro does not work

Source: Internet
Author: User


I recently used boost for development and feel very good. I will write down my thoughts in the future.


When using boost serialization.


A problem occurs when the sequence class is derived. Always prompts "unregist class", but it is clear that related macros are added to the definition file in the class declaration.

... H

# Include <boost/serialization/export. HPP>
/// After the release, the subsequent strings cannot be changed; otherwise, the old files cannot be read.
Boost_class_export_key2 (class1, "class1 ")


... CPP

Boost_class_export_implement (class1)



At last, you can only add the content in the serialization area of the document.

...

STD: ifstream file (filename );
Assert (file. Good ());
Boost: Archive: xml_iarchive AR (File );

Ar. template register_type <class1> ();
...


.


The purpose of the preceding two macros is to eliminate the need to add ar. template register_type <class1>.



it seems that two macros do not work when they exist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.