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 7660691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:30:00+00:00 2026-05-31T13:30:00+00:00

I am serializing the cl_long2 type from OpenCL which is defined like this (simplified

  • 0

I am serializing the cl_long2 type from OpenCL which is defined like this (simplified from /usr/include/CL/cl_platform.hpp):

typedef int64_t cl_long;
typedef union
{
    cl_long __attribute__ ((aligned(16))) s[2];
    struct{ cl_long  x, y; };
    struct{ cl_long  s0, s1; };
    struct{ cl_long  lo, hi; };
} cl_long2;

I defined the following stand-alone serialization function:

namespace boost{ namespace serialization {
template<class Archive> void serialize(Archive &ar, cl_long2 &i, const unsigned version){
   ar & make_nvp("x",i.x);
   ar & make_nvp("y",i.y);
}

}};

When I compile my code, which invokes a serialization of cl_long2 from as a class member, I am getting the following error, which I cannot understand (the error is the same if it is not a std::vector<cl_long2>, just a stand-alone variable):

/usr/include/boost/archive/detail/check.hpp: In function ‘void boost::archive::detail::check_object_level() [with T = cl_long2]’:
/usr/include/boost/archive/detail/iserializer.hpp:438:9:   instantiated from ‘static void boost::archive::detail::load_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = cl_long2, Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/detail/iserializer.hpp:592:5:   instantiated from ‘void boost::archive::load(Archive&, T&) [with Archive = boost::archive::xml_iarchive, T = cl_long2]’
/usr/include/boost/archive/detail/common_iarchive.hpp:66:9:   instantiated from ‘void boost::archive::detail::common_iarchive<Archive>::load_override(T&, int) [with T = cl_long2, Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/basic_xml_iarchive.hpp:86:9:   instantiated from ‘void boost::archive::basic_xml_iarchive<Archive>::load_override(const boost::serialization::nvp<T>&, int) [with T = cl_long2, Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/xml_iarchive.hpp:93:9:   instantiated from ‘void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = const boost::serialization::nvp<cl_long2>, Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:60:9:   [ skipping 5 instantiation contexts ]
/usr/include/boost/serialization/split_free.hpp:58:9:   instantiated from ‘static void boost::serialization::free_loader<Archive, T>::invoke(Archive&, T&, unsigned int) [with Archive = boost::archive::xml_iarchive, T = std::vector<cl_long2>]’
/usr/include/boost/serialization/split_free.hpp:74:5:   instantiated from ‘void boost::serialization::split_free(Archive&, T&, unsigned int) [with Archive = boost::archive::xml_iarchive, T = std::vector<cl_long2>]’
/usr/include/boost/serialization/vector.hpp:151:5:   instantiated from ‘void boost::serialization::serialize(Archive&, std::vector<U, Allocator>&, unsigned int) [with Archive = boost::archive::xml_iarchive, U = cl_long2, Allocator = std::allocator<cl_long2>]’
/usr/include/boost/serialization/serialization.hpp:128:9:   instantiated from ‘void boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::xml_iarchive, T = std::vector<cl_long2>]’
/usr/include/boost/archive/detail/iserializer.hpp:188:5:   instantiated from ‘void boost::archive::detail::iserializer<Archive, T>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const [with Archive = boost::archive::xml_iarchive, T = std::vector<cl_long2>]’
myFile.cpp:368:2:   instantiated from here
/usr/include/boost/archive/detail/check.hpp:60:5: error: static assertion failed: "typex::value"

The same error appears regardless of whether the archive type is xml or binary. I am using boost::serialization 1.46.

Any hints?

**EDIT: A smaller example including error is at http://ideone.com/4UgCn

  • 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-31T13:30:01+00:00Added an answer on May 31, 2026 at 1:30 pm

    If you look at the line where the assertion fails (detail/check.hpp:60), there is a comment right above it:

    // trap attempts to serialize objects marked
    // not_serializable
    BOOST_STATIC_ASSERT(typex::value);
    

    The documentation of this ‘not_serializable’ trait says that you have to enable this long2 type first. As you found out, this is done by:

    BOOST_CLASS_IMPLEMENTATION(long2,boost::serialization::object_serializable)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am serializing a class like this into JSON using Flexjson: public class Item
I'm serializing a class like this public MyClass { public int? a { get;
I'm currently serializing objects like this: public static string ObjToJson(List<MyObject> TheObjects){ JavascriptSerializer TheSerializer =
From this paper : Avoid unnecessarily serializing algorithms: Algorithms such as random number generators
When serializing a django model object, the format is like this: { pk:1, model:book,
Serializing this class works fine. However, sometimes I'd like to exclude the field. Is
got a question regarding serializing classes that I've defined. I have some classes like
I am serializing Lists of classes which are my data entities. I have a
I am serializing a string from a multiline text box to an XML. Is
If youa are serializing a form using something like jQuery, it will often map

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.