Questions tagged [containers]

A container is a class, a data structure, or an abstract data type whose instances are collections of other objects. Containers typically make use of generics or templates so that a wide variety of objects can be added.

Containers are available in most programming languages, allowing programmers to store, transfer, and read back data within a program. Common containers include arrays, lists, queues, stacks, sets, and maps, each providing different levels of efficiency for tasks such as adding or removing elements, searching for elements, or iterating through elements.

11206 questions
29
votes
4 answers

Performance degradation due to default initialisation of elements in standard containers

(Yes, I know there is a question with almost the same title, but the answer was not satisfactory, see below) EDIT Sorry, the original question didn't use compiler optimization. This is now fixed, but to avoid trivial optimization and to come closer…
Walter
  • 44,150
  • 20
  • 113
  • 196
28
votes
9 answers

'Multipurpose' linked list implementation in pure C

This is not exactly a technical question, since I know C kind of enough to do the things I need to (I mean, in terms of not 'letting the language get in your way'), so this question is basically a 'what direction to take' question. Situation is: I…
Rafael Almeida
  • 10,352
  • 6
  • 45
  • 60
28
votes
11 answers

Docker Timezone in Ubuntu 16.04 Image

I have created a Docker container using the Ubuntu 16.04 image. docker run -it -d --name containername -v /var/www/public --privileged ubuntu after creating the container, I checked the date inside the container: $ date Tue Oct 25 08:10:34 UTC…
Rajkumar .E
  • 1,440
  • 3
  • 20
  • 34
28
votes
2 answers

What's inside a Docker image/container?

Considering the fact that docker images/containers come in various flavours - Ubuntu, CentOS, CoreOS etc.... I'm curious what actually makes up an image/container, and what is shared with the host OS? Where is the dividing line? For example, I can…
Nigel Poulton
  • 393
  • 1
  • 3
  • 7
28
votes
4 answers

Is the behaviour of Python's list += iterable documented anywhere?

It would appear that in Python, list += x works for any iterable x: In [6]: l = [] In [7]: l += [1] In [8]: l += (2, 3) In [9]: l += xrange(5) In [10]: l Out[10]: [1, 2, 3, 0, 1, 2, 3, 4] Is this behaviour documented anywhere? To contrast this…
NPE
  • 486,780
  • 108
  • 951
  • 1,012
27
votes
8 answers

Heterogeneous containers in C++

I saw this nice graphic which classifies which STL container would suit based on different requirements of data such as: -- Fixed Size Vs Variable size -- Data of same tyme Vs different type -- Sorted Vs unsorted data -- Sequential Vs random…
goldenmean
  • 18,376
  • 54
  • 154
  • 211
27
votes
3 answers

How to run podman from inside a container?

I want to run podman as a container to run CI/CD pipelines. However, I keep getting this error from the podman container: $ podman info ERRO[0000] 'overlay' is not supported over overlayfs Error: could not get runtime: 'overlay' is not supported…
Fabio Gomez
  • 687
  • 2
  • 7
  • 13
27
votes
3 answers

There is any "Podman Compose"?

I recently found out about Podman (https://podman.io). Having a way to use Linux fork processes instead of a Daemon and not having to run using root just got my attention. But I'm very used to orchestrate the containers running on my machine (in…
otaviofcs
  • 785
  • 2
  • 6
  • 16
27
votes
1 answer

Using '*' in docker exec command

I am trying to run specific command inside running docker container. Docker exec -t t1 ls /tmp/sth/* in return I receive ls: cannot access '/tmp/sth/*': No such file or directory In fact when I execute command while inside container everything…
Wiciaq123
  • 486
  • 4
  • 13
27
votes
4 answers

Connect to host mongodb from docker container

So I want to connect to my mongodb running on my host machine (DO droplet, Ubuntu 16.04). It is running on the default 27017 port on localhost. I then use mup to deploy my Meteor app on my DO droplet, which is using docker to run my Meteor app…
Patrick DaVader
  • 2,133
  • 4
  • 24
  • 35
27
votes
7 answers

How can I pass a part of a vector as a function argument?

I'm using a vector in a C++ program and I need to pass a part of that vector to a function. If it was C, I would need to do the following (with arrays): int arr[5] = {1, 2, 3, 4, 5}; func(arr+2); // Pass the part of the array {3, 4, 5} Is there…
mohit
  • 5,696
  • 3
  • 24
  • 37
26
votes
7 answers

How can I write a generic container class that implements a given interface in C#?

Context: .NET 3.5, VS2008. I'm not sure about the title of this question, so feel free to comment about the title, too :-) Here's the scenario: I have several classes, say Foo and Bar, all of them implement the following interface: public…
Ron Klein
  • 9,178
  • 9
  • 55
  • 88
26
votes
2 answers

C++ iterator to const_iterator

How do I acquire a const_iterator (of some container class) from an iterator (of that container class) in C++? What about a const_iterator from an insert_iterator? The resulting iterator should point at the same spot as the original does.
Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
26
votes
3 answers

Git LFS give x509: certificate signed by unknown authority

I have just setup an Ubuntu 18.04 LTS Server with Gitlab following the instructions from https://about.gitlab.com/install/#ubuntu. I have issued a ssl certificate from GoDaddy and confirmed this works with the Gitlab server. I have then updated…
EON CTO
  • 261
  • 1
  • 3
  • 4
26
votes
1 answer

containerd.io vs docker-ce-cli vs docker-ce: what are the differences and what does each package do?

I am trying to install docker on my laptop and I find that there are three packages from the repo: containerd.io docker-ce-cli docker-ce Can anyone explain to me in simple words what the differences are among these packages, what each one of them…
NickZeng
  • 1,180
  • 2
  • 12
  • 22