C++ vector of char array

You cannot store arrays in vectors (or in any other standard library container). The things that standard library containers store must be copyable and assignable, and arrays are neither of these. If you really need to put an array in a vector (and you probably don’t – using a vector of vectors or a vector … Read more

Java collections faster than c++ containers?

This sort of statement is ridiculous; people making it are either incredibly uninformed, or incredibly dishonest. In particular: The speed of dynamic memory allocation in the two cases will depend on the pattern of dynamic memory use, as well as the implementation. It is trivial for someone familiar with the algorithms used in both cases … Read more

add elements to object array

You can try Subject[] subjects = new Subject[2]; subjects[0] = new Subject{….}; subjects[1] = new Subject{….}; alternatively you can use List List<Subject> subjects = new List<Subject>(); subjects.Add(new Subject{….}); subjects.Add(new Subject{….}); // Then you can convert the List to Array like below: Subject[] arraySubjects = subjects.ToArray<Subject>()

BlockingCollection(T) performance

There are a couple of potential possibilities, here. First, BlockingCollection<T> in the Reactive Extensions is a backport, and not exactly the same as the .NET 4 final version. I wouldn’t be surprised if the performance of this backport differs from .NET 4 RTM (though I haven’t profiled this collection, specifically). Much of the TPL performs … Read more