boost

How does ptr_vector manage memory?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 15:26:06
问题 I'm currently getting myself into c++ for lower level coding with opengl. I come from a heavy objc background so I have some understanding about memory management but I can't seem to get how the "boost" library manages container types like ptr_vector . I think my problem is related to the fact that I have no idea how ptr_vector manages the destruction of itself and its objects. Please take a look at the following code: // Header file ... ptr_vector<IObject3D> objects; ... // Implementation

How does ptr_vector manage memory?

爱⌒轻易说出口 提交于 2020-01-22 15:26:05
问题 I'm currently getting myself into c++ for lower level coding with opengl. I come from a heavy objc background so I have some understanding about memory management but I can't seem to get how the "boost" library manages container types like ptr_vector . I think my problem is related to the fact that I have no idea how ptr_vector manages the destruction of itself and its objects. Please take a look at the following code: // Header file ... ptr_vector<IObject3D> objects; ... // Implementation

Boost serialization : forward compatibility fail with input stream error

放肆的年华 提交于 2020-01-21 19:29:49
问题 Following this question : Boost serialize child class I'm trying to support forward compatibility for my archive generated with boost serialization but i'm having trouble reading a newer archive with older code : class A { public: A() {} virtual ~A() = default; private: friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, const unsigned int version) { ar &mAttributeFromA; } std::string mAttributeFromA = "mAttributeFromA"; }; BOOST_CLASS_VERSION(A, 0)

Using STL containers for boost::interprocess::managed_shared_memory

孤街醉人 提交于 2020-01-21 18:53:51
问题 Consider the following situation: class Helper { public: // Getters and setters are present! private: int i; std::map<int, boost::interprocess::managed_shared_memory> shm; } int main() { boost::interprocess::managed_shared_memory shmInfo(boost::interprocess::open_or_create, "Test", 1024); boost::interprocess::map<int, Helper> myMap = shmInfo.construct< boost::interprocess::map<int, Helper> >("Memory"); } myMap (which is a map of int and Helper ) is constructed on the shared_memory. In turn, I

Simultaneous Logging to Console and File using Boost

社会主义新天地 提交于 2020-01-21 14:01:10
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Simultaneous Logging to Console and File using Boost

半腔热情 提交于 2020-01-21 13:59:08
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Simultaneous Logging to Console and File using Boost

我的梦境 提交于 2020-01-21 13:59:06
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Boost filesystem path append for char array

点点圈 提交于 2020-01-21 12:42:55
问题 The snippet of the code is: boost::filesystem::path petscConfigurationPath; petscConfigurationPath.append("FluidPetsc/Basic.conf"); It results in the following errors with boost 1.54: error: no matching function for call to ‘boost::filesystem::path::append(const char [22])’ petscConfigurationPath.append("FluidPetsc/Basic.conf"); ^ note: candidates are: In file included from /usr/include/boost/filesystem.hpp:16:0, /usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path&

boost graph library - minimal example of vertex colors and graphviz output

∥☆過路亽.° 提交于 2020-01-21 11:01:07
问题 Being new to the boost graph library, I find it's often difficult to tease out what pieces of the examples are tied to the particular example and which parts are universal to usage. As an exercise, I'm trying to make a simple graph, assign a color property to the vertices, and output the result to graphviz so colors appear as color attributes that get rendered. Any help would be appreciated! Here's what I have so far (more specific usage questions are in the comments here): #include "fstream"

boost graph library - minimal example of vertex colors and graphviz output

时光毁灭记忆、已成空白 提交于 2020-01-21 11:00:05
问题 Being new to the boost graph library, I find it's often difficult to tease out what pieces of the examples are tied to the particular example and which parts are universal to usage. As an exercise, I'm trying to make a simple graph, assign a color property to the vertices, and output the result to graphviz so colors appear as color attributes that get rendered. Any help would be appreciated! Here's what I have so far (more specific usage questions are in the comments here): #include "fstream"