containers

C++ Pointers, objects, etc

It may be a bit confusing, but... Let's say I have a vector type member in a class, something like vector<Operator*> ( I have methods on my class to return Operators from this container). Now lets say that I have a method on my class that receives an Operator object op and inserts it on the vector. What I want to know is: will I have an...

Flex 4: Is it possible to have a BorderContainer automatically size to the contents within it?

I have a BorderContainer with several objects inside of it. I want it to fit snugly around its own contents, but it doesn't. It seems the default size of a BorderContainer is 112x112. That is so wierd considering no other containers have that default size. Is there a way to set the width and heigh properties to "auto" or something like t...

How to change size of STL container in C++

I have a piece of performance critical code written with pointers and dynamic memory. I would like to rewrite it with STL containers, but I'm a bit concerned with performance. Is there a way to increase the size of a container without initializing the data? For example, instead of doing ptr = new BYTE[x]; I want to do something like...

Version of STL optimized for compile time?

Hi! I'm looking for a variant of the STL (it's okay if it doesn't have all the functionality) that's optimized for short compile times -- I get bothered by long compile times that delay my compile-debug-edit cycle. I'm mainly interested in the containers of the STL: vector/map, and not so much the algorithms. Thanks! ...

Container for database-like searches

I'm looking for some STL, boost, or similar container to use the same way indexes are used in databases to search for record using a query like this: select * from table1 where field1 starting with 'X'; or select * from table1 where field1 like 'X%'; I thought about using std::map, but I cannot because I need to search for fields t...

why is unbounded_array more efficient than vector?

It says here that The unbounded array is similar to a std::vector in that in can grow in size beyond any fixed bound. However unbounded_array is aimed at optimal performance. Therefore unbounded_array does not model a Sequence like std::vector does. What does this mean? ...

How to know if an enumerator has reached the end of the collection in C#?

Hello, I am porting a library from C++ to C#. The old library uses vectors from C++ and in the C# I am using generic Dictionaries because they're actually a good data structure for what I'm doing (each element has an ID, then I just use using TypeDictionary = Dictionary<String, Type>;). Now, in the C# code I use a loop like this one Typ...

How to change the size of the font of a JLabel to take the maximum size

Hello, I have a JLabel in a Container. The defaut size of the font is very small. I would like that the text of the JLabel to take the maximum size. How can I do that ? Thanks :) ...

Posting source code in blogger- fails with C# containers

I tried the solutions that are posted in this related SO question and for the most part the code snippets are working, but there are some cases that are still getting garbled by Blogger when it publishes the blog. In particular, declaring generic containers seems to be most troublesome. Please see the code examples on my blog: http://ml...

A minimalistic smart array (container) class template

I've written a (array) container class template (lets call it smart array) for using it in the BREW platform (which doesn't allow many C++ constructs like STD library, exceptions, etc. It has a very minimal C++ runtime support); while writing this my friend said that something like this already exists in Boost called MultiArray, I tried ...

WPF: How to autosize Path to its container?

I have a Path that must resize to its StackPanel container. <StackPanel x:Name="TrackSurface"> <Path Fill="AliceBlue" Stroke="Black" StrokeThickness="1" Data="{StaticResource TranslateZ}"> </Path> </StackPanel> I think about using a transformation bound to the container but don't know how to it actually. Ca...

Casting a container of shared_ptr

Hi all, I have a method void foo(list<shared_ptr<Base>>& myList); Which I'm trying to call with a two different types of lists, one of DerivedClass1 and one of DerivedClass2 list<shared_ptr<DerivedClass1>> myList1; foo(myList1); list<shared_ptr<DerivedClass2>> myList2; foo(myList2); However this obviously generates a compiler ...

vector iterator not dereferencable at runtime on a vector<vector<vector<A*>*>*>

Hi, I have this destructor that create error at runtime "vector iterator not dereferencable". The gridMatrix is a std::vector<std::vector<std::vector<AtomsCell< Atom<T> * > * > * > * > I added the typename and also the typedef but I still have the error. I will move for this idea of vect of vect* of vect* to use boost::multi_array I ...

Sanity Check - will a stl::Container of new'd objects each be deleted when the container itself dies?

Title pretty much covers it. If I've added say 3 objects to a list and the list goes out of scope and dies, will it call delete on each entry before going out of scope? Pretty sure yes, but getting tired and need a sanity check. ...

What C# container is most resource-efficient for existence for only one operation?

I find myself often with a situation where I need to perform an operation on a set of properties. The operation can be anything from checking if a particular property matches anything in the set to a single iteration of actions. Sometimes the set is dynamically generated when the function is called, some built with a simple LINQ statemen...

allocating extra memory for a container class.

Hey there, I'm writing a template container class and for the past few hours have been trying to allocate new memory for extra data that comes into the container (...hit a brick wall..:| ) template <typename T> void Container<T>::insert(T item, int index){ if ( index < 0){ cout<<"Invalid location to insert " << index << endl...

Is there a concurrent container library for C++

Possible Duplicate: Is there a production ready lock-free queue or hash implementation in C++ I'm looking for implementations of lock-free containers: Queue Stack Hash Map etc... How about blocking containers: Blocking Queue Blocking Stack Are there any good libraries out there? I would like to refrain from writing the...

C++ iterator and const_iterator problem for own container class

Hi there, I'm writing an own container class and have run into a problem I can't get my head around. Here's the bare-bone sample that shows the problem. It consists of a container class and two test classes: one test class using a std:vector which compiles nicely and the second test class which tries to use my own container class in ex...

Can 'iterator' type just subclass 'const_iterator'?

After another question about iterators I'm having some doubts about custom containers. In my container, iterator is a subclass of const_iterator, so that I get conversion from non-const to const "for free". But is this allowed or are there any drawbacks or non-working scenarios for such a setup? ...

How to extract metafile from TOleContainer?

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 ins...