boost-ptr-container

Difference between std::unordered_map < K, boost::ptr_deque < T > >'s operator[] (K const &) and emplace

ぐ巨炮叔叔 提交于 2019-12-12 04:58:48
问题 #include <memory> #include <unordered_map> #include <vector> #include <utility> #include <boost/ptr_container/ptr_deque.hpp> struct T { T() = default; T(T const &) = delete; T & operator = (T const &) = delete; T(T &&) = default; T & operator = (T &&) = default; }; using S = boost::ptr_deque < T >; int main() { std::unordered_map < uint32_t, S > testum; // testum.emplace(1u, S()); // testum.insert(std::make_pair(1u, S())); testum[1].push_back(new T()); } In the above example, the commented

Measuring performance of vector<unique_ptr> on VS2013?

社会主义新天地 提交于 2019-12-10 13:40:24
问题 TL;DR Is the optimizer of VS2013 confused or are my measurements wrong or does the global dummy in fact need to be volatile to make the test valid or ____ ? Disclaimer : This is mostly out of "academic" interest, I would not expect the differences I see to really affect any production code. Intro: Some recent measurements of mine then led me to this question because I saw significant differences between std::vector<std::unique_ptr<T> > and boost::ptr_vector on VS2013. (also see comments there

boost ptr_container library isn't installed after compilation from source

China☆狼群 提交于 2019-12-07 10:12:29
问题 I have updated boost library from previous 1.54 (svn source) to 1.57 (git source). Although I used the same ./b2 params, destination directory doesn't contain ptr_container library. Directory with cloned repository correctly contains ptr_container library on this path: boost_git/libs/ptr_container I'm building it with following command: ./b2 --install --prefix=$SHL_PATH/boost -sNO_BZIP2=1 -sNO_ZLIB runtime-link=shared link=shared -j2 install but without success. Edit: It seems that problem

boost ptr_container library isn't installed after compilation from source

社会主义新天地 提交于 2019-12-05 14:41:24
I have updated boost library from previous 1.54 (svn source) to 1.57 (git source). Although I used the same ./b2 params, destination directory doesn't contain ptr_container library. Directory with cloned repository correctly contains ptr_container library on this path: boost_git/libs/ptr_container I'm building it with following command: ./b2 --install --prefix=$SHL_PATH/boost -sNO_BZIP2=1 -sNO_ZLIB runtime-link=shared link=shared -j2 install but without success. Edit: It seems that problem occurs only when building from git. When I downloaded zip package from boost site, destination directory

stl container with std::unique_ptr's vs boost::ptr_container

∥☆過路亽.° 提交于 2019-11-27 14:38:29
With c++11 out there, I was asking myself if there is a replacement of the boost::ptr_containers in c++11. I know I can use e.g. a std::vector<std::unique_ptr<T> > , but I'm not sure if this is a complete replacement. What is the recommended way of handling these cases? They really solve two similar but different problems. A pointer container is a way to store objects in a container that just so happen to be pointers to allocated memory rather than values. They do everything in their power to hide the fact that they are a container of pointers. This means: Entries in the container cannot be

stl container with std::unique_ptr's vs boost::ptr_container

谁都会走 提交于 2019-11-26 16:50:12
问题 With c++11 out there, I was asking myself if there is a replacement of the boost::ptr_containers in c++11. I know I can use e.g. a std::vector<std::unique_ptr<T> > , but I'm not sure if this is a complete replacement. What is the recommended way of handling these cases? 回答1: They really solve two similar but different problems. A pointer container is a way to store objects in a container that just so happen to be pointers to allocated memory rather than values. They do everything in their