Hello All
please help me understand the below code snippet,

LDAPControl** LDAPControlSet::toLDAPControlArray() const{
    DEBUG(LDAP_DEBUG_TRACE, "LDAPControlSet::toLDAPControlArray()" << endl);
        return 0;
        LDAPControl** ret= new LDAPControl*[data.size()+1];
        CtrlList::const_iterator i;
        int j=0;
        for(i=data.begin(); i!=data.end(); i++,j++){
            ret[j] = i->getControlStruct();
        return ret;

please note in the above code,
data and const_iterator are of list type (typedef by CtrlList), which is private member of the class


I saw this code or something like this in almost all post started by you. Try to solve your problems with single thread; especially when your program/problem definition is same or minor different.

Yes, I agree to adatapost. Just stick onto one post and then you can ask questions... That way everyone will know what exactly is happening.

Now to your problem,
Firstly, We would like to know where in exactly are you having trouble in understanding the code.

Use the color tags [color="red"] some code in here [/color] To specify those places.

It is also a little hard to know what the function calls of "DEBUG" do as we donot know its implementation.

However the other part is understandable, By Logic though its not by exact understanding.

For example:


I assume that this is a class but I donot know the members in it nor the functions it has. So I stick onto the assumption.

With that reason, It is hard to tell what exactly going on but we can give you a faint picture which you will have to figure out :) (Given that you specify the places in which you donot understand the code.)

This article has been dead for over six months. Start a new discussion instead.