I have a UDP server which gets messages in a buffer, that I would like to store like a mailbox. For this, I would like to create either a vector or a map that could hold these incoming messages, but the value of my map or vector keeps pointing to the current value of the buffer.

How do I get the values properly stored in a map or vector?

To demonstrate my issue, I've written a simple static example which represents what happens in my script:

```
#include <map>
#include <iostream>

int main(int argc, char const *argv[])
{
    char buffer[65535];
    std::map<int, char *> messages;

    buffer = {'h','e','l','l','o'};
    messages[0] = buffer;

    buffer = {'h','o','w'};
    messages[1] = buffer;

    buffer = {'a','r','e'};
    messages[2] = buffer;

    buffer = {'y','o','u'};
    messages[3] = buffer;

    std::cout << messages[0] << std::endl;
    std::cout << messages[1] << std::endl;
    std::cout << messages[2] << std::endl;
    std::cout << messages[3] << std::endl;

    return 0;
}

```

The outcome of this is:

```
you
you
you
you

```

But I would like to get:

```
hello
how
are
you

```

How do I achieve this?