containers

How to use boost lambda to populate a vector of pointers with new objects

Hi, I've recently started using boost lambda and thought I'd try and use it in places where it will/should make things easier to read. I have some code similar to the following std::vector< X * > v; for ( int i = 0 ; i < 20 ; ++i ) v.push_back( new X() ); and later on, to delete it... std::for_each( v.begin(), v.end(), boost::l...

Jboss Container specific restart

Hi. We have a jboss server with multiple containers in it. Container1 deploying war1 and container2 deploying war2. We use the command $JBOSS_HOME/bin/shutdown.sh -S -s Does this command restarts all the containers; or there is a ip-port config to trigger restart/shutdown for specific containers? Is there even an option to restart ...

Storage of a high score table, what kind of container?

Say I have a high score table structured like name score name score .... I need to do some file operations and manipulate certain areas of the file, and I thought the best way to do this would be to store it in a container that preserved the order of the file, do the data manipulation with the container, then output back to the file. ...

boost serialization issue with shared_ptr to std containers

Hi I am using boost/1.41.0, and the following code give me compilation error when I try to deserialize a shared_ptr. The serialize part it compiled successfully. Can someone advise me if this is a bug in my code or a general issue for boost? Thanks. Yanchao #include <iomanip> #include <iostream> #include <cstddef> // NULL #include <fst...

Serialize ComponentModel.Container???

Is it possible to serialize (binary) a System.ComponentModel.Container? ...

Not using iterators into a resized vectors

I read in The C++ Programming Language : Special Edition Don't use iterators into a resized vector Consider this example. vector< int >::iterator it = foo.begin(); while ( it != foo.end() ) { if ( // something ) { foo.push_back( // some num ); } ++it; } Is there a problem with this? After the vector was resized, would the...

C++ container/array/tuple consistent access interface

hello Is there, perhaps in boost, consistent element access semantics which works across containers? something along the lines of: element_of(std_pair).get<1>(); element_of(boost_tuple).get<0>(); element_of(pod_array).get<2>(); in principle i can write myself, but I would rather not reinvent the wheel.thanks ...

How can I check if something leaves the Screen? - JFrame

I have a ball based on a component and I've thought that using the isShowing() method would do the trick but after my ball leaves the container, (Pong game) the isShowing() method still returns true. So does the isShowing() method check if the component is still in the container's... bounds? Or just if it is visible and the container is...

C++0x "move from" container

In C++0x, we get an efficiency boost concerning containers with std::move: SomeExpensiveType x = /* ... */; vec.push_back(std::move(x)); But I can't find anything going the other way. What I mean is something like this: SomeExpensiveType x = vec.back(); // copy! vec.pop_back(); // argh This is more frequent (the copy-pop) on adapte...

typedef and containers of const pointers

The following line of code compiles just fine and behaves: list<const int *> int_pointers; // (1) The following two lines do not: typedef int * IntPtr; list<const IntPtr> int_pointers; // (2) I get the exact same compile errors for list<int * const> int_pointers; // (3) I'm well aware that the last line is not legal since the...

Moving children of a container (defined in MXML) inside an "inner container"

I'm currently working on a custom component which extends Canvas (let's call it SuperCanvas) ; it's basically a container that let you zoom & pan its contents. It would be too long to explain why, but I can't use scrollRect, so I was forced to declare a Canvas object (called innerCanvas)... inside my SuperCanvas (I know, not very nice =...

Is it Bad Practice to use C++ only for the STL containers?

First a little background ... In what follows, I use C,C++ and Java for coding (general) algorithms, not gui's and fancy program's with interfaces, but simple command line algorithms and libraries. I started out learning about programming in Java. I got pretty good with Java and I learned to use the Java containers a lot as they tend t...

Problem - Container changing size automatically in Java

I've found that my container is actually changing it's size a short while after being constructed When it's constructed, I set my components to be at the place I want (like 30px away from the right edge) but later after a short while, I find that it turns from 1008x730 to 1018x740... (My JFrame is 1024x768) Does anyone know why this h...

Container access and allocation through the same operator?

I have created a container for generic, weak-type data which is accessible through the subscript operator. The std::map container allows both data access and element insertion through the operator, whereas std::vector I think doesn't. What is the best (C++ style) way to proceed? Should I allow allocation through the subscript operator ...

C++ standard/de facto STL algorithm wrappers.

hello Are there any standard/de facto standard (boost) wrappers around standard algorithms which work with containers defining begin and end. Let me show you what I mean with the code: // instead of specifying begin and end std::copy(vector.begin(), vector.end(), output); // write as xxx::copy(vector, output); I know it can be writte...

C++ containers behavior

Hello. My question is simple. When I use STL containers, do they copy the value I store there (by using copy constructor) or not? What if I give them array of characters (char *) instead of string instance? How do they behave? Is guaranteed that information will be stored in heap instead of system stack? Thanks for answers. ...

What is the address of back() in an empty container?

I mistakenly took the address of the reference returned by the back() operator in an empty container and was surprised to see that the address wasn't zero. If a container e.g. std::deque is empty, what does back() return? ...

Firefox 3.6 not displaying content - xajax, jquery, css

Hi, I know this question may sound vague, but I have been debugging (PHP and js) our application for a day now and have not found any issues in the data generation. Our application uses xajax to generate lists based on data that we have in our DB. we have a list in particular that works on every other browser: IE 7&8, Firefox 3.0.13(Lin...

Making child control an IContainer

I've created a control class that inherits a Panel control. This control then contains two other panels, one of which I would like to be an IContainerControl. I know how to turn the entire control into a IContainerControl but have been unable to do the same to a child control. I've tried in both C# and VB.Net and failed with both. Do...

Are Python built-in container thread-safe ?

Hi, I would like to know if the python built-in container (list, vector, set...) are thread-safe ? Or do I need to implement a locking/unlocking environment for my shared variable. Thanks in advance ...