Boost logo

Boost :

From: zlf (zlfcn_at_[hidden])
Date: 2005-05-05 20:42:45


Hi,
    That is a good idea.Thank you

zlf

"Jonathan Wakely" <cow_at_[hidden]>
??????:20050505103008.GA31189_at_compsoc.man.ac.uk...
> On Thu, May 05, 2005 at 06:10:32PM +0800, zlf wrote:
>
>> Hi all,
>> What is the easiest way to assign mulitply value for a defined number
>> array?
>>
>> Assigning mulitply elements' value when defining like this will be
>> OK.
>> int test [ 2 ] = { 1 , 2 };
>>
>> If I want to assign value for the number array [test] after defining
>> it.
>> I only know I can achieve this by the following step.
>>
>> int test [ 2 ];
>> test [ 0 ] = 1;
>> test [ 1 ] = 2;
>>
>> [int test [ 2 ]; test = { 1 , 2 };] seems easy and reasonable. But
>> executing it will get a compile error. What is the easiest way to assign
>> mulitply value for a defined number array? Thx
>
> Using nothing non-std you can initialise another array and copy from it:
>
> int test [ 2 ];
> // ...
> int tmp[2] = { 1, 2 };
> std::copy(tmp, tmp+2, test);
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk