Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How do I construct a Vector from a C-style array?
Re: How do I construct a Vector from a C-style array? [message #52423 is a reply to message #52421] Mon, 23 September 2019 09:56 Go to previous messageGo to previous message
huadong is currently offline  huadong
Messages: 5
Registered: September 2019
Promising Member
Are you looking what the code like this?

#include <Core/Core.h>

using namespace Upp;


int main()
{
int a[] = {1, 2, 3, 4};
int *p = a;
int n = 4;

Vector<int> v;
for (auto begin = p, end = p+n; begin != end; ++begin)
v << *begin;

for (int &x : v)
printf("x = %d\n", x);
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Simple way to develope 2D Game
Next Topic: Questions on the editor and hotkeys. And yet.
Goto Forum:
  


Current Time: Mon Apr 29 05:14:11 CEST 2024

Total time taken to generate the page: 0.01995 seconds