Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7700859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:50:41+00:00 2026-05-31T22:50:41+00:00

I have to use class Matrix4x4 from some 3rd party library, and I need

  • 0

I have to use class Matrix4x4 from some 3rd party library, and I need to serialize it.

1. Is it ok to create header(3rdparty_serialization.h) that will contain all serialization that is needed for 3rd party libraries, like Matrix4x4:

namespace boost {
namespace serialization {

template<class Archive>
void serialize(Archive & ar, Matrix4x4 & m, const unsigned int version)
{
    for(size_t i = 0; i < 4;++i)
        for(size_t j = 0; j < 4;++j)
        {
            auto& e = m[i][j];
            ar & BOOST_SERIALIZATION_NVP(e);
        }
}

} // namespace serialization
} // namespace boost

2. Is this definition of function “serialize” for Matrix4x4 correct?

3. How to customize formatting of Matrix4x4 serialization?
Now, I have output:

<m class_id="2" tracking_level="0" version="0">
    <e>1</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>1</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>1</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>0</e>
    <e>1</e>
</m>

I want something like this:

<m class_id="2" tracking_level="0" version="0">
        <e>1;0;0;0</e>
        <e>0;1;0;0</e>
        <e>0;0;1;0</e>
        <e>0;0;0;1</e>
</m>

or other more compact and readable form.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:50:42+00:00Added an answer on May 31, 2026 at 10:50 pm

    1. Yes.

    2. Yes, assuming Matrix is not within a namespace.

    3. You could try serializing std::strings instead of individual elements. However, this is a bit wasteful since you will need to format and parse the strings. Also not optimal for size if you want to use e.g. binary_[io]archive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to use a class/assembly made in C# .NET from native C++ application.
I have the following use case: There's a class called Template and with that
I have following code snippet that i use to compile class at the run
I have to create a class dynamically but I want to use class constructor
I have this PHP class, whose purpose is to fetch some configuration data from
Does anybody use the Class Designer much in Visual Studio? I have downloaded the
I don't have any idea how to use this class in .net. Anyone wants
To make a long story short I have to use processing in a class
I have a class I use to split a string of SQL commands by
I'd like to use the snoopy class, but I don't have the proper server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.