containers

What is the reason of QVector's requirement for default constructor?

情到浓时终转凉″ 提交于 2019-11-28 03:46:39
问题 I can see that that classes are treated as complex objects which are required for calling default constructor: void QVector<T>::defaultConstruct(T *from, T *to) { if (QTypeInfo<T>::isComplex) { while (from != to) { new (from++) T(); } ... } But it's not clear why is it needed to construct objects in the 'hidden' area of QVector. I mean these objects are not accessible at all, so why not just to reserve the memory instead of the real object creation? And as a bonus question, I would like to

Are pointers allowed as keys in ordered STL containers?

允我心安 提交于 2019-11-28 03:41:18
问题 There's this other question asking about how comparing pointers is supposed to be interpreted wrt the C++ Std. So I was wondering what the C++ Std has to say about using pointers as keys in ordered standard library (STL) containers -- i.e. is one allowed to have std::map<T1*, T2> and is this due to the specification of std::less or builtin operator < ? 回答1: Yes, because it uses std::less , which is required to result in a total order even if < doesn't. ( < would be allowed to treat different

Java EE Containers vs Web Containers

北战南征 提交于 2019-11-28 03:27:46
I'm relatively new to Java EE/EJB, and I've been reading alot regarding Java EE containers. I've had experience working with a web container (WAR file in jboss). I am also aware that Jboss can also be used as a Java EE container. My question is, what is the difference between a Java EE container against a web container? I know Java EE is also able to contain a .war file. Are they different and what are their differences? Are there any preferences vendor specific-wise which is better? Miljen Mikic First of all, "J2EE" is an obsolete abbreviation, it is now simply called "Java Enterprise Edition

Why does std::stack use std::deque by default?

强颜欢笑 提交于 2019-11-28 03:14:10
Since the only operations required for a container to be used in a stack are: back() push_back() pop_back() Why is the default container for it a deque instead of a vector? Don't deque reallocations give a buffer of elements before front() so that push_front() is an efficient operation? Aren't these elements wasted since they will never ever be used in the context of a stack? If there is no overhead for using a deque this way instead of a vector, why is the default for priority_queue a vector not a deque also? (priority_queue requires front(), push_back(), and pop_back() - essentially the same

Appending to PATH in a Windows Docker container

梦想与她 提交于 2019-11-28 03:13:51
问题 I need to append to the PATH within a Windows Docker container, and I've tried many permutations. ENV PATH=%PATH%;C:\\Foo\\bin ENV PATH=$PATH;C:\\Foo\\bin ENV PATH="%PATH%;C:\Foo\bin" ENV PATH="$PATH;C:\Foo\bin" RUN "set PATH=%PATH%;C:\Foo\bin" None of these work: they don't evaluate the preexisting PATH variable. What is the right syntax to append to the PATH? Can I even append to the PATH inside Docker? (I can on similar Linux containers) 回答1: Unfortunately ENV won't work, because windows

docker: “build” requires 1 argument. See 'docker build --help'

二次信任 提交于 2019-11-28 03:12:59
Trying to follow the instructions for building a docker image from the docker website. https://docs.docker.com/examples/running_redis_service/ this is the error I get will following the instructions on the doc and using this Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get install -y redis-server EXPOSE 6379 ENTRYPOINT ["/usr/bin/redis-server"] sudo docker build -t myrepo/redis docker: "build" requires 1 argument. See 'docker build --help'. How do resolve? You need to add a dot, example docker build -t mytag . it means you use the Dockerfile in the local directory, and if you use

Could multiple proxy classes make up a STL-proof bitvector?

流过昼夜 提交于 2019-11-28 02:56:48
问题 It's well known that std::vector<bool> does not satisfy the Standard's container requirements, mainly because the packed representation prevents T* x = &v[i] from returning a pointer to a bool. My question is: can this be remedied/mitigated when the reference_proxy overloads the address-of operator& to return a pointer_proxy? The pointer-proxy could contain the same data as the reference_proxy in most implementations, namely a pointer into the packed data and a mask to isolate the particular

How to increase the size of the /dev/shm in docker container

核能气质少年 提交于 2019-11-28 02:48:59
问题 Currently When I create new docker container the size of the shared memory directory is limited to 64MB. But, I need to increase this size since my application depend on this shared memory. Is there any way to increase the size of /dev/shm in docker container? I heard that the 64MB is hard coded in the docker code, How to install docker from source and change the value of the /dev/shm? 回答1: You can modify shm size by passing the optional parameter --shm-size to docker run command. The default

Standard container re-allocation multipliers across popular toolchains

这一生的挚爱 提交于 2019-11-28 01:57:33
Containers like std::basic_string and std::vector perform automatic re-allocations when internal capacity runs out. The standard specifies that, after a re-allocation, .capacity() >= .size() . What are some of the actual multipliers used by mainstream toolchains when performing re-allocations? Update So far, I have: Dinkumware: 1.5 (ships with MSVS and possibly ICC) GNU libstdc++: 2 (ships with GCC and possibly ICC) RW/Apache stdcxx: 1.618 (aka φ) STLport: 2 New answer for an old question. Rationale: The answer can be answered programatically, and with online compilers, relatively easily. Here

How to specify Http Request timeout parameter on Java servlet container

 ̄綄美尐妖づ 提交于 2019-11-28 01:47:38
I'm trying to understand where I can configure a request timeout for all requests arriving to a servlet of mine (or all of my servlets)? Is that, as I think, a container property? Also, how does this affect different browsers? Do they all comply to the parameter the container dictates? Or maybe the request timeout time isn't even something I can control and each browser decides on this on its own? (Just to be clear I'm not talking about session timeout) The timeout from a client (i.e. how long it waits for a response to an HTTP request) is determined at the client. For IE, see this , and for