containers

Container of derived objects / smart pointers

对着背影说爱祢 提交于 2020-01-07 08:29:12
问题 Lets say i have: class Base {...}; class Derived1 : public Base {...}; class Derived2 : public Base {...}; class Derived3 : public Base {...}; class Store { public: void Add(const Base&); //Adds mix of Derived1/2/3 private: vector<const Base*> vec; vector<shared_ptr<const Base> > vec_smart; }; //------------------------------------------------------ void Store::Add(const Base& b){ vec.push_back(&b); //got sliced } When using vector of pointers to Base, it got sliced. I suppose i have to use

C++ How to avoid access of members, of a object that was not yet initialized

无人久伴 提交于 2020-01-07 07:24:28
问题 What are good practice options for passing around objects in a program, avoiding accessing non initialized member variables. I wrote a small example which I think explains the problem very well. #include <vector> using namespace std; class container{public:container(){} vector<int> LongList; bool otherInfo; }; class Ship { public:Ship(){} container* pContainer; }; int main() { //Create contianer on ship1 Ship ship1; ship1.pContainer = new container; ship1.pContainer->LongList.push_back(33);

Zend Form and nested fieldsets/containers?

别等时光非礼了梦想. 提交于 2020-01-06 14:46:13
问题 I have a form. I have a single element that needs to be wrapped in a div or fieldset (for formatting). Then I have two groups of elements, including the above, that I want to wrap in a fieldset or div. I've managed to create two groups, but Zend Form seems to balk at letting me create a group containing a group. Should I be able to do this? Here's a simple code example, assuming I have created elem1, elem2 and elem3. $form->addDisplayGroup(array('elem1'), 'group1', array("legend" => "Wrapped

what is the difference between container and panel?

こ雲淡風輕ζ 提交于 2020-01-06 13:43:09
问题 I am really get big confused in container and panel i heard the components which we are adding that will be added to the container object,but also i heard it will added to the panel.... then who display the components on applet... does it display by container or it display by panel?? Also tell me guys the blank white surface are in applet is panel or container??? And What is container???? i also wrote program on container and panel but not understanding the concept of these both.. please

How to copy files from server to docker container

蓝咒 提交于 2020-01-06 06:19:28
问题 I am trying to create a Windows Nano Server container and copy some files from server to the new container. Below is my dockerfile code: FROM microsoft/nanoserver MAINTAINER test@gmail.com COPY C:/files/ C:/files/ When I run it, I am getting below error: Copy failed:createFile \?\c:\programdata\Docker\tmp\docker-builder78565487\files: The system canot find the path specified. How do I declare source location in COPY command, so it uses absolute path and copy files to c:\files location on my

How to copy files from server to docker container

流过昼夜 提交于 2020-01-06 06:19:08
问题 I am trying to create a Windows Nano Server container and copy some files from server to the new container. Below is my dockerfile code: FROM microsoft/nanoserver MAINTAINER test@gmail.com COPY C:/files/ C:/files/ When I run it, I am getting below error: Copy failed:createFile \?\c:\programdata\Docker\tmp\docker-builder78565487\files: The system canot find the path specified. How do I declare source location in COPY command, so it uses absolute path and copy files to c:\files location on my

How to implement microservices architecture with docker compose?

﹥>﹥吖頭↗ 提交于 2020-01-05 21:11:12
问题 I am working on a web application that requires few microservices like a URL shorter, mailer, analytics, etc... Each of these services are implemented as REST api so they can talk to each other. Each of these services have a docker-compose.yml file and use containers like nginx, php, mysql, etc… I want these to work as a single system. I don’t want to expose these REST apis to anyone outside of the docker network My question is how can I combine multiple docker-compose.yml files from each

Is the mutability of Swift containers shallow? Or can an element be mutated in place?

ε祈祈猫儿з 提交于 2020-01-05 12:58:27
问题 I have a collection of objects in a Set . The objects' type follows GeneratorType , so I have a mutating method next . Although I can mutate the set by adding/removing elements, I don't know how to mutate an element. Using both for-in statement and the forEach method give errors about the element being immutable. Is the mutability of Swift containers shallow? Is there a way to call a mutating method on a contained element? Does it work for other collection/sequence types besides Set ? (My

Is the mutability of Swift containers shallow? Or can an element be mutated in place?

余生颓废 提交于 2020-01-05 12:57:48
问题 I have a collection of objects in a Set . The objects' type follows GeneratorType , so I have a mutating method next . Although I can mutate the set by adding/removing elements, I don't know how to mutate an element. Using both for-in statement and the forEach method give errors about the element being immutable. Is the mutability of Swift containers shallow? Is there a way to call a mutating method on a contained element? Does it work for other collection/sequence types besides Set ? (My

Docker security concerns using unofficial images

主宰稳场 提交于 2020-01-05 04:27:28
问题 How to ensure, that docker container will be secure, especially when using third party containers or base images? Is it correct, when using base image, it may initiate any services or mount arbitrary partitions of host filesystem under the hood, and potentially send sensitive data to attacker? So if I use third party container, which Dockerfile proves the container to be safe, should I traverse the whole linked list of base images (potentially very long) to ensure the container is actually