456 questions
2
votes
1
answer
81
views
Does Boost guarantee safety of deserealization?
For example, a client serializes std::vector, std::unordered_map, boost::optional, std::shared_ptr or some other type whose serialization mechanism is laid out directly in Boost, and then sends it to ...
0
votes
0
answers
102
views
Linking error with boost serialization module
I'm porting a Visual SLAM C++ project from Ubuntu to Windows. I'm able to build the package core as library and its dependency packages (g2o, DBoW2, Pangolin). However, when linking the final ...
1
vote
1
answer
51
views
Will Boost serialisation break if I rename the class name?
I am working on a project which has working serialization logic. I have renamed the class name using Visual Assist. Will this break the current logic? Do I need any versioning to handle this?
I tried ...
0
votes
1
answer
76
views
Boost serialization with empty container
I am using boost ( 1.69.0 ) serialization to generate an XML template file.
The result I want to achieve is unfortunately bad.
This is example code:
struct A
{
struct B
{
int bInt;
...
1
vote
2
answers
192
views
boost serialization incompatibility between 1.74 and 1.83 with multi index container
I am serializing a set of contents, indexed by multiple properties using boost::multi_index_container, and a params struct, into a binary archive which I want to deserialize latter. But the archive ...
1
vote
1
answer
99
views
Boost Serialization to char buffer and Deserialization from data
I am making a communication module between processes using boost::interprocess::message_queue
Because message queue takes array buffer, I would to serialize a packet into an array buffer.
inline void ...
2
votes
1
answer
119
views
How to implement boost::serialize for tbb::concurrent_vector
I am using tbb::concurrent_vector in place of std::vector in some places but am also using boost serialization in order to serialise the containers, and concurrent_vector does not come with one ...
0
votes
1
answer
48
views
boost serialization fails on cyclic restore
I try to implement a serializer for two classes Geometry and Dimension that have a cyclic dependency between them. That means Geometry can have a Dimension and a Dimension knows its Geometry. Also, I ...
2
votes
1
answer
337
views
Input stream error when deserializing with boost
I'm trying to use the boost serialization library to serialize a class. The serializing works just fine but when I try to read the contents that were wrote to a file a get an "input error" ...
1
vote
1
answer
183
views
Boost polymorphic serialization cause "unregistered class" with registered classes
Serialization with boost for polymorphic classes does not seem to work.
I have a virtual class (cf. Base) and a child class (cf. Derived), I have tried several methods to register them (cf. ...
0
votes
1
answer
418
views
How to link boost library as dynamic library instead of static in vcpkg
I'm using VS 2019 with vcpkg and boost 1.81
I've created a Dynamic Link Library Project (c++) and I've added the boost serialization library headers.
when I set vcpkg to use static libraries it builds ...
1
vote
1
answer
132
views
Boost Serialization: Serialize/Export derived class without default constructor
I need to serialize all the options on my CommunicationLayer, which is basically a wrapper around serial port, which I will use in an initialization file of sorts.
This class doesn't have a default ...
1
vote
1
answer
268
views
C++ Serializing object to binary format with Boost
I have class with the below structure,
class Myclass {
int myInt;
char myChar;
UDFString str; //user-defined string class
string myString;
UDFObj obj; //this is user-defined class and ...
1
vote
1
answer
54
views
How to allow to "forget" objets types in boost::serialize
I use Boost to serialize classes I register with register_type, as described here.
Later, if I decide a specific class is no longer useful, and I want to open old file and discard the forgotten class ...
1
vote
1
answer
183
views
Very slow destructors of binary_oarchive and filtering_streambuf
I noticed that destructors of binary_oarchive and filtering_streambuf are extremely slow and I don't know why. I'm running the following code:
namespace bfs = boost::filesystem;
namespace bar = boost::...
1
vote
1
answer
112
views
boost::serialization of boost::optional of type with private default constructor
I'm upgrading from boost 1.54 to the latest 1.80 and have a compilation problem with boost serialization.
I have a class A with private default constructor. Another class B has a boost::optional<A&...
0
votes
1
answer
72
views
Boost ASIO deserialization wrong values
when I try to deserialize a struct on the server, I am receiving incorrect values from initial transmission. I created a struct with member variables of the same type (2 and 1); however, when ...
1
vote
0
answers
132
views
boost::binary_iarchive instead of boost::text_iarchive from SQLite3 Blob
I'm not an expert on streams and buffers, though I have learned an immense amount over the last month since I started tackling this problem.
This concerns boost::serialization and if I can get the ...
2
votes
1
answer
424
views
C++20 concepts: How do I use concepts to check if an object can use shared_from_this()?
I was thinking I could maybe do this:
template <typename T>
concept CanMakeSharedFromThis = std::is_base_of<std::enable_shared_from_this<T>, T>::value;
But I think it's not working.
...
1
vote
1
answer
243
views
why my boost serialization failed with input stream error?
I have a complex class, which need to serialization.
I use boost.serialization.
The class is a singleton class, with several function. singleton is not the vital part, because i have tried some simple ...
1
vote
0
answers
231
views
How serialize a class with pointer in boost.serialization?
I am trying to serialize a singleton class with pointer.
boost.serialization is a good tools. it can work well if there is no pointer member variable.
once include pointer, read it back will crased.
...
2
votes
1
answer
342
views
How does Boost::serialization store user-defined classes in archives?
I have a user-defined object (call it Foo) which consists of some primitive variables, as well as other (external library) objects which already contain implementations of the serialize function.
I ...
2
votes
1
answer
113
views
How to know if shared_ptr was already serialized to boost archive
In my program I have c++ class objects that keep SmartPointers members (SmartPointer is my own custom class derived from boost::shared_ptr). By design, some of my class objects must keep SmartPtr that ...
3
votes
1
answer
565
views
How to binary serialize in a buffer with Boost
How to binary serialize in a buffer?
I didn't find answer on official documentation and on stackoverflow it absent too.
The most part of examples show how to binary serialize in some file.
Other part ...
1
vote
1
answer
2k
views
How do I serialize better using boost?
i'm using boost C++ library to serialize data into binary and text file. But while serializing data it adds headers which I do not want. Is there any way to remove these headers?
for example :
#...
1
vote
1
answer
702
views
Boost.Serialize: writing a general map serialization function
Boost.Serialize provides explicit serialization for std::map / std::multimap, which won't work with other map-like containers.
I'd like to serialize those without needing to rewrite these functions ...
2
votes
1
answer
502
views
writing struct to .txt file
I'm trying to store my struct into txt file using boost but unable to do it. I'm using boost library.
example structure
struct Frame
{
uint32_t address{ 0 };
uint16_t marks{ 0 };
uint16_t ...
2
votes
0
answers
397
views
Boost Serialization linker errors using CMake on macOS
My colleague came to me with some linker errors they were seeing when trying to compile some code using CMake that was using Boost::serialization functionality. I tried to help them work through the ...
2
votes
1
answer
228
views
Unknown Exception in construction of boost::archive::text_iarchive from std::istringstream
I seem to be getting an error in constructing a boost::archive::text_iarchive from a std::istringstream
#include <vector>
#include <string>
#include <thread>
#include <atomic>
#...
1
vote
1
answer
175
views
Can I skip some variables in boost serialization?
I have Players class and it has some variables
class Players
{
private:
friend class boost::serialization::access;
template <class Ar>
void serialize(Ar &ar, unsigned)
{
...
3
votes
1
answer
181
views
Warnings when using Boost Serialization with -Wall -Wextra
I'm trying to use Boost.serialize. It appears to work fine, but I'm getting warnings when I turn on -Wextra and -Wall warnings with g++ (Version 10.2.0).
It ran fine, and compiled fine when I switch ...
2
votes
0
answers
621
views
Serializing data into a C++17 std::byte vector
I'm trying to serialize/deserialize data to/from std::vector<std::byte>. The code below shows one solution with boost::serialization, but I think this applies to other serialization libraries. ...
1
vote
1
answer
285
views
C++ Boot serialization cause a segmentation fault
I have those two classes and I'm trying to deserialize them using boost
class WorldItem
{
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(...
3
votes
1
answer
861
views
getting "input stream error" when trying to desirealize the object using boost::serialization and arcive
I'm trying to send a class over boost::message queue using boost::serialization, boost::Arcive, and boost::split members (load and save)
the problem is when I'm trying to deserialize I'm getting the ...
0
votes
0
answers
199
views
faild to link boost::serialization with Clion and CMAKE
Im trying to link my code with the boost::serialization library but I'm getting undefined reference errors:
CMakeFiles/shared_memory.dir/main.cpp.o: In function `void boost::archive::save_access::...
1
vote
1
answer
439
views
Boost serialization: add new register_type without breaking compatibility
I use Boost to serialize a NeuralNetwork object with code like this
template <class Archive>
void NeuralNetwork::serialize(Archive& ar, unsigned version)
{
boost::serialization::...
0
votes
1
answer
145
views
Input stream problem when using std::array
When there is no bool b in struct A, the code works. When bool b is there, ar & mat gives "input stream error" but registering elements of std::array one by one works. What's wrong here?
...
0
votes
1
answer
81
views
Check an archive whether it is a binary/text/xml
I created an output text_archive and I restored it using binary archive and obviously, got some issues.
Can I know somehow the kind of archive, so that I could possibly use the appropriate code for ...
1
vote
1
answer
315
views
Can boost::container::strings be serialized using boost serialization?
I am attempting to serialize a class which contains a boost::container::string
#include <iostream>
#include <cstdlib>
#include <boost/container/string.hpp>
#include <boost/archive/...
1
vote
1
answer
422
views
Input stream error with boost serialization
I am trying to load serialized content and I have been unable to solve the issue. I have boiled it down to a specific line of code. I tried to minimize the code as best as possible but also show some ...
1
vote
1
answer
139
views
boost Serialisation on a variant containing boost::blank
I have a boost::variant wherein one of the fields has the boost::blank field, using boost::serialise on the same throws an error saying error: no member named 'serialize' in 'boost::blank'.
Is there ...
-1
votes
2
answers
197
views
Boost de-serialized Object has nan or -nan values
I recently asked about de-serialization a map for which I got an answer here : De-Serializing an STL map class member
The problem I am now face is that I get nan values for some Point object values. ...
2
votes
1
answer
517
views
Is boost::serialization::base_object required every time I do inheritance?
I have:
non-polymorphic (no virtual methods) class hierarchy;
base class already contains serialize;
child classes are serialized directly;
class A
{
private:
int x;
int y;
...
3
votes
1
answer
115
views
De-Serializing an STL map class member
I am new to boost & boost serialization. I am trying to de-serialize a STL map class member. Here is the code
:
...
class Face
{
friend std::ostream & operator<<(std::ostream &os, ...
1
vote
1
answer
595
views
Convert boost serialized object's asio::streambuf representation into Beast's DynamicBody req.body()
// Serialize using boost serialization
boost::asio::streambuf binary_buffer;
boost::archive::binary_oarchive archive(binary_buffer);
archive << world_map;
//beast::...
2
votes
1
answer
436
views
How to Serialize glm::vec3 with boost
I am trying to serialize a glm::vec3 variable in my Camera class.
class Camera
{
glm::vec3 Position;
float Yaw;
private:
friend class boost::serialization::access;
template<typename ...
0
votes
0
answers
76
views
runtime issue with boost serialization using different compilers/environments
I have a piece of code that serializes a struct on file.
int main(int argn, char* argv[]){
if (argn > 2){
std::cout << "Error! this program requires a single argument.\n";
...
1
vote
1
answer
56
views
Is there a way to auto-generate or at least shorten (some parameter like __all__) the serialize function?
I am dealing with a network where messages(request as well as responses) are transferred as structs. For achieving this, I turned to boost-serialization, which works great! but with so many types of ...
1
vote
1
answer
761
views
How does boost::serialization allocate memory when deserializing through a pointer?
In short, I'd like to know how boost::serialization allocates memory for an object when deserializing through a pointer. Below, you'll find an example of my question, clearly illustrated alongside ...
3
votes
1
answer
2k
views
Error using boost serialization with binary archive
I get the following error while reading from boost::archive::binary_iarchive into my variable:
test-serialization(9285,0x11c62fdc0) malloc: can't allocate region
*** mach_vm_map(size=...