Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Double to string conversion
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Gavin Deane, post: 2547158"] I guess complicated is in the eye of the beholder. The construction syntax is quite cumbersome if you've not seen it before. But what's going on isn't too complicated, and the parameter passing syntax is a lot simpler - no need to put the array sizes in the function declaration at all (so avoiding the risk of making a mistake by, for example, getting them the wrong way round or using the wrong values entirely). #include <vector> typedef std::vector<std::vector<std::vector<int> > > vec3d; const int dimensions = 5; const int grid_points = 42; const int the_third_one = 7; int main() { vec3d bar(dimensions, std::vector<std::vector<int> >(grid_points, Not at all. Multideimensional arrays are part of the language and std::vector is part of the library. Both are standard. The point is that, if the standard library provides some tool that does what you need, you are better of using it than writing your own equivalent code. The standard library implementation will be well tested, familiar (hopefully) to other C++ programmers working on you code, and should lead you more quickly to a clear and correct program. As a reference, this book is worth it's weight in gold IMO. [URL]http://www.josuttis.com/libbook/[/URL] Gavin Deane [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Double to string conversion
Top