containers

How to extract metafile from TOleContainer?

做~自己de王妃 提交于 2019-11-30 17:41:28
问题 I have a Delphi (BDS 2006) application with TOleContainer control. It has an OLE object inside, MS Equation formula (name 'Equation.3') from MS Office 2003. How can I extract the vector metafile from the formula image to insert it into web-page or some other document without OLE support? TOleContainer has only 'Equation.3' objects inside, no other possibilities. I've tried to use .Copy method to make it through clipboard, but it's copied an empty image. 回答1: OLE Container has on underlying

Why is std::vector contiguous?

蓝咒 提交于 2019-11-30 17:27:46
Besides the fact that the standard defines it to be contiguous, why is std::vector contiguous? If it runs out of space, it needs to reallocate a new block and copy the old block to the new one before continuing. What if it wasn't contiguous? When the storage fills up, it would just allocate a new block and keep the old block. When accessing through an iterator, it would do simple >, < checks to see which block the index is in and return it. This way it doesnt need to copy the array every time it runs out of space. Would this really work/be better? or am i missing something? If std::vector didn

Mount docker host volume but overwrite with container's contents

纵然是瞬间 提交于 2019-11-30 17:26:01
Several articles have been extremely helpful in understanding Docker's volume and data management. These two in particular are excellent: http://container-solutions.com/understanding-volumes-docker/ http://www.alexecollins.com/docker-persistence/ However, I am not sure if what I am looking for is discussed. Here is my understanding: When running docker run -v /host/something:/container/something the host files will overlay (but not overwrite) the container files at the specified location. The container will no longer have access to the location's previous files, but instead only have access to

Copy std::vector into std::array

女生的网名这么多〃 提交于 2019-11-30 17:20:24
How do I copy or move the first n elements of a std::vector<T> into a C++11 std::array<T, n> ? Use std::copy_n std::array<T, N> arr; std::copy_n(vec.begin(), N, arr.begin()); Edit: I didn't notice that you'd asked about moving the elements as well. To move, wrap the source iterator in std::move_iterator . std::copy_n(std::make_move_iterator(v.begin()), N, arr.begin()); You can use std::copy : int n = 2; std::vector<int> x {1, 2, 3}; std::array<int, 2> y; std::copy(x.begin(), x.begin() + n, y.begin()); And here 's the live example. If you want to move, instead, you can use std::move : int n = 2

C++: converting a container to a container of different yet compatible type

﹥>﹥吖頭↗ 提交于 2019-11-30 16:59:01
问题 It often happens to me to have a a container C (or whatever kind of wrapper class, even smart pointers) for a type T1 , and want to convert such C<T1> into C<T2> , where T2 is compatible to T1 . C++ doesn't allow me to directly convert the whole container, and forcing a reinterpet_cast would result in undefined behavior, so I would need to create a new C<T2> container and repopulate it with C<T1> items casted as T2 . This operation could be quite expensive, both in time and space. Moreover

Mount docker host volume but overwrite with container's contents

霸气de小男生 提交于 2019-11-30 16:40:01
问题 Several articles have been extremely helpful in understanding Docker's volume and data management. These two in particular are excellent: http://container-solutions.com/understanding-volumes-docker/ http://www.alexecollins.com/docker-persistence/ However, I am not sure if what I am looking for is discussed. Here is my understanding: When running docker run -v /host/something:/container/something the host files will overlay (but not overwrite) the container files at the specified location. The

How to check whether a container is stable

杀马特。学长 韩版系。学妹 提交于 2019-11-30 16:38:22
问题 std::vector is an unstable container, i.e. by resizing the vector, iterators might become invalidated. In contrast, std::list or boost::container::stable_vector are stable containers which keep the iterators valid until the removal of the corresponding element. Is there a way to check whether a given container is stable? For instance, if I have something like template<template <typename A, typename B=std::allocator<A> > class T=std::list> class Foo { } Is it possible to allow only for stable

Is there an open-source alternative to Windows compound files? [closed]

让人想犯罪 __ 提交于 2019-11-30 16:16:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I'm trying to save a couple of files to a container file. The files can be modified later which means the container might have to be enlarged. The user should only see this container as a single file in the file system. The application is written in C++ and running on Windows, but the files should be portable to

Is there an open-source alternative to Windows compound files? [closed]

岁酱吖の 提交于 2019-11-30 16:00:03
I'm trying to save a couple of files to a container file. The files can be modified later which means the container might have to be enlarged. The user should only see this container as a single file in the file system. The application is written in C++ and running on Windows, but the files should be portable to other platforms as well. The requirements for the container format are: 1. Size : Allow files bigger than 4GB. 2. Portability : It should be feasible to open the container files on other platforms. 3. Performance : When changing a file inside the container, only the "chunks" that

How to make GCE instance stop when its deployed container finishes?

∥☆過路亽.° 提交于 2019-11-30 15:35:33
I have a Docker container that performs a single large computation. This computation requires lots of memory and takes about 12 hours to run. I can create a Google Compute Engine VM of the appropriate size and use the "Deploy a container image to this VM instance" option to run this job perfectly. However once the job is finished the container quits but the VM is still running (and charging). How can I make the VM exit/stop/delete when the container exits? When the VM is in its zombie mode only the stackdriver containers are left running: $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS