darek9576's Profile User Rating: ***--

Reputation: 200 Stalwart
Active Members
Active Posts:
1,693 (0.89 per day)
13-March 10
Profile Views:
Last Active:
User is offline Apr 24 2015 09:01 AM

Previous Fields

Dream Kudos:
Icon   darek9576 has not set their status

Posts I've Made

  1. In Topic: Function Help?

    Posted 24 Apr 2015

    The function should take a constant string reference so that a copy is not performed and then destroyed.
  2. In Topic: Doubles not adding in C++

    Posted 29 Oct 2014

    You might want to try to use transform() function:

    double value = velocity;
    std::transform(weights.begin(), weights.end(), weights.begin(), [velocity](int currentValue){ return currentValue + velocity;});
  3. In Topic: Dynamic array of pointers syntax

    Posted 24 Sep 2014

    Thanks for the answer. The confusion i guess comes from the fact of too many "*".

    So, first question is: does the TYPE between "new" and "[size]" indicate what type the array will hold?

    new T[size];

    means that we will have an array of type T allocated on the heap?
    new int*[size];
    new unique_ptr<Person>[size];

    means that we will have an array holding (as its elements) values of type int* and unique pointers to Person object on the heap?

    If that is the case, why dont we have the syntax:

    int* a = new int*[size];

    Why do we need the second asterisk as in int**.

    Because i believe to dynamically allocate an array of unique pointers we would do:

    std::unique_ptr<int>* upa = new std::unique_ptr<int>[size]; (again, not sure if corret)

    Hope you can confirm the first question and explain the last one.
  4. In Topic: Vector and copy constructor

    Posted 27 Aug 2014

    Thanks for the answers.
    @CTphpnwb - the only reason i used pointers to strings was just to learn how exactly vectors and copy constructors work. I do realize that usually it's not what should be done.
    @vividexstance - i am aware of move semantics and smart pointers but for now they are too advanced.
  5. In Topic: why do we use private fields

    Posted 9 Aug 2014

    What if you have a Person class and setAge() function and the outside uses it and does:


    I never heard of anyone living thousand years. Read about encapsulation.

My Information

Member Title:
D.I.C Lover
Age Unknown
Birthday Unknown

Contact Information

Click here to e-mail me


darek9576 hasn't added any friends yet.


darek9576 has no profile comments yet. Why not say hello?