containers

.NET - I want to do this: Dim D as new Dictionary(of String, Array(OF MYOBJECT))

I'd like to create a Dictionary that is indexed by Strings: Dictionary(of String, ...) I'd like the Type after the comma to be an Array of MyObject's. If all I do is the following: Dim D as new Dictionary(of String, Array) I feel like I'm missing out on some performance very time I access a member: Dim Object1 as MyObject = MyDict...

.NET containers - when are members By Reference, By Value?

I migrate between C++ and VB.NET in my coding ventures... which leads to the occasional confusion about when something is by value or by reference in VB.NET. Let's say for example that I have an array of MyObject which is populated with a bunch of objects. dim MyArr(5000) of MyObject Now let's say that the information from this array...

C++ boost::thread and automatically locking containers

Is there a way to automatically lock an STL container on access, without having to lock and release around it? ...

Cycling through a SortedList - Why is this faster?

List1 in the following example is a SortedList(Of MyClass) and contains 251 members. The first two codeblocks execute in 15.5 seconds. 1: For cnt As Integer = 1 To 1000000 For Each TempDE In List1 Dim F As String = TempDE.Key TempDE.Value.x1 = 444 Next Next 2: For cnt As Integer = 1 ...

[Java] Containers class owner's child object having to add components into his parent's container problem

Hi, I am having problems dealing with containers and components in my JApplet. I don't put my code because I think there is no need for it. The main class owns the getContentPane(). Another class (let's call it class1) owns a JLayeredPane() and components that are added to it. Another class (let's call it class2) only have components...

Templates and nested classes/structures

I have a simple container : template <class nodeType> list { public: struct node { nodeType info; node* next; }; //... }; Now, there is a function called _search which searches the list and returns a reference to the node which matched. Now, when I am referring to the return-type of the...

check type of element in stl container - c++

how can i get the type of the elements that are held by a STL container? ...

ie7 and ie8 ignore "margin:0px auto;"

http://blog.helpcurenow.org I'm working on the development of this blog and it seems ie7 and ie8 both are displaying the content so that the container seems to be ignoring the "margin:0px auto;" rule. It could be something else I'm just not getting, but either way the effect is that the content (as well as the navigational links) are f...

What is the right approach when using STL container for median calculation?

Let's say I need to retrieve the median from a sequence of 1000000 random numeric values. If using anything but STL::list, I have no (built-in) way to sort sequence for median calculation. If using STL::list, I can't randomly access values to retrieve middle (median) of sorted sequence. Is it better to implement sorting myself and go...

Where do I get sample code in C++ creating iterator for my own container?

I have been searching for sample code creating iterator for my own container, but I haven't really found a good example. I know this been asked before (http://stackoverflow.com/questions/148540/c-creating-my-own-iterators) but didn't see any satisfactory answer with examples. I am looking for simple sample code to start how to design ...

Custom container requirement to work with Qt's foreach

What is the bare minimum amount of code to create a custom container that would work with Qt foreach macro? I have this so far template< class T > class MyList { public: class iterator { public: }; class const_iterator { public: inline iterator& operator++ () { return *this; } }; }; and I'm getting ...

The page lifecycle for controls(order contructed from a page)

Ok, I have not been able to really find an answer to this on the internet.. Maybe someone here can help me. For example, lets say I have a page and 2 custom controls on that page. During what event on page do these controls get constructed. When does their page_init get called? Also, for these 2 custom controls, do they both get const...

std::string a container

Is std::string a container class in standard c++ library, restricted to hold only char elements? ...

Axapta: force container integer to be stored as a string

Is there a way to force a container to store all values as strings? I am using str2con in order to split text strings into containers. Any time a field with numbers only comes up, it is stored as an int, which isn't a huge problem. What IS a big problem is when the string of numbers exceeds the integer size and the number becomes somet...

Can a reference type be used as the key type in an STL map

Can I construct an std::map where the key type is a reference type, e.g. Foo & and if not, why not? ...

c# stack queue combination

hi! is there in C# some already defined generic container which can be used as Stack and as Queue at the same time? I just want to be able to append elements either to the end, or to the front of the queue thanks ...

Multi-Dimensional Container in Java

I searched around on Google, but I was unable to find any libraries for a multi-dimensional container in Java (preferably one that supports generics as well). I could easily write one (in fact, I have started to), but I was hoping that I would be able to reuse the work someone else has done for the sake of efficiency. I don't necessari...

What is Container-Based Authentication?

I know the "XMLHttpRequest" object supports a method "open" which has an optional parameter of a username and password. I just found out that these parameters can be supplier for requests requiring container-based authentication. This is the method signature: open(method, url, async, username, password) Can someone help me out with t...

Iterating over pair elements in a container of pairs (C++)

If I have a container (vector, list, etc) where each element is a std::pair, is there an easy way to iterate over each element of each pair? i.e. std::vector<std::pair<int,int> > a; a.push_back(std::pair(1,3)); a.push_back(std::pair(2,3)); a.push_back(std::pair(4,2)); a.push_back(std::pair(5,2)); a.push_back(std::pair(1,5)); and the...

Yield from C# to C++, dealing with containers

Hi there. Actually, I have a design question here. Its very simple but the point is: I have one C++ class that has a STL vector declared as a private member. But the clients of that class need to iterate over this vector. In C# we have a very handy statement, the Yield, that in cases like that, you write a function returning an IEnu...