containers

best data structure for byIndex and byName retrieval

suppose you need to implement container of a T items, which its value could be retrieved by numeric index (which is random access) and by name (as string). which one is better in term of performance of common operation such as retrieval, adding, and removing the items: (in this case retrieval by index need to be implemented by walking...

Performance - checking if container is empty before doing operations on it?

Is there a significant difference between doing this... if ( !myVector.empty()) { for ( unsigned int i = 0; i < myVector.size(); ++i ) { // do stuff } } and this for ( unsigned int i = 0; i < myVector.size(); ++i ) { // do stuff } if the vector is empty? What is the cost of this on an empty vector? ...

Can another application access a private key stored in a key container using RSACryptoServiceProvider?

I am using RSACryptoServiceProvider to generate public/private key pair and using cspParameters object to store it in a key container. My problem is that after i store the private key in a key container, can another application access the key container and retrieve the private key i generated? If yes, the security of the key is compro...

C++ - parameter question

Hello! I am looking for some simple and efficient parameter container that would act like a in-memory-xml file representation (or ini-file, as another sample). I mean, basically it could store sections and sets of parameters for each section, have easy accessors like GetValue("ParameterName") and simple return value casting. It would ...

Container that doesn't require its elements to be default and copy constructible

I'm looking for a C++ container-like class that wraps a typed array of objects that are not necessarily initialized and don't have to be default-constructible or copy-constructible. This would be interesting for RAII objects that have no well-defined copy semantics. Such a container-like class seems to be fairly easy to write (using an a...

Do STL iterators guarantee validity after collection was changed?

Lets say I have some kind of collection an I obtained an iterator for the beginning of it. Now lets say I modified the collection. Can I still use the iterator safely? (regardless of the type of the collection or the iterator) To avoid confusion , Here is the order of operations I talk about: Get an iterator of the collection. Modify ...

Order a container by member with STL

Suppose I have some data stored in a container of unique_ptrs: struct MyData { int id; // a unique id for this particular instance data some_data; // arbitrary additional data }; // ... std::vector<std::unique_ptr<MyData>> my_data_vec; The ordering of my_data_vec is important. Suppose now I have another vector of IDs of My...

Comparing OpenEjb and Glassfish

Dear all, can we replace Glassfish with Tomcat/OpenEJB for lighter applications? What is the performance of OpenEJB comparing to glassfish as EJB container. What is the restrictions of OpenEJB instead of glassfish? Regards ...

What is the right way to free a std::vector of pointers in C++?

I searched StackOverflow but couldn't find the answer to this question. Suppose I have a std::vector<Day *> vector_day - that is - a vector of pointers to Day object. Now I push_back to vector_day many elements: vector_day.push_back(new Day(12)); vector_day.push_back(new Day(99)); vector_day.push_back(new Day(71)); ... Now at some po...

What does container invalidation in C++ mean?

I learned today about the term invalidation in context of C++ containers. Can anyone explain what it means? It seems like you're not allowed to modify elements of a container in some way when looping over the container. But what way exactly? Please help me understand this topic. Thanks, Boda Cydo. ...

how to work with container components using FFmpeg?

So are there any examples\materials on how to work with containers elements using ffmpeg? GFLV "tags" for example or Mpeg atoms? ...

How are elements stored in containers in .Net?

Hi How are elements stored in containers in .Net? For example, a C++ vector stores in sequential order, while List doesn't. How are they implemented for .Net containers (Array, ArrayList, ...)? Thanks. ...

Windsor Configuration Standard Practices

The app I inherited uses the fluent interface for configuring our Windsor container, and it's this big glob o' configuration that's pretty disgusting. In the past I created an extension method container.AddModule and then created modules that were passed in the container and registered services a la StructureMap for the different "modul...

How to create a HTML container which will fill all available width between two floating elements?

Here is a schema of what I want to render, and as simple as it seems I can't find a way to code the container between the two floating elements...: ---------- ---------- | | Some text text text text text text text text | | | | text (in a <p> element). ...

What is an iterator's default value?

For any STL container that I'm using, if I declare an iterator (of this particular container type) using the iterator's default constructor, what will the iterator be initialised to? For example, I have: std::list<void*> address_list; std::list<void*>::iterator iter; What will iter be initialised to? ...

C++ - basic container question

Hello! How should the following cases be handled: I have some geometrical storage, which is a template from vertex type. template <typename T> struct Geometry { std::vector<T>& GetVertices() { ... } const void* RawVertices() const { ... } } This works fine, unless I want to store different types of geometries (for instance, Geome...

SSIS is not executing sequentially

I have a very simple SSIS pacakge having 3 containers in the control flow. Each container is explicitly connected by a precedence constraint which evaluation operation is set to constraint only and each has a pre-execute event handler in it. When I run the package from Visual Studio, it works perfect but when I run it from DTExec.exe, it...

Flex 3 - Change box border colors

Hi! I have a question that might seem "basic" but I just cannot figure out how to do it... I have a box and I'd like to change the borderColor. Till there, nothing special. Just a box.bordercolor = xxxxxx... BUT, I'd like to have the top and bottom border with one color, and the left and right border with another color... And that's t...

C++ Templates - Specifying a container type and that containers element type that it holds

I want to be able to create a function where I specify a parameter to have both a templated container and a templated element type for that container. Is this possible? I get "error C2988: unrecongnizable template declaration/definition" among others. Here is the function in question. template<class Iter, class Elem> void readIntoP(...

Class or Container to store heterogenous items in C++

Is there any structure or class or container which i can use to store heterogenous items which is serializable. For example say i have a int,float and another class object. I want to store all of them in a particular container at runtime and pass it across classes. Does C++ give any such options. ...