please refer the code below,

    /**
     * Constructs an empty std::list
     */
    LDAPControlSet();

only this much is there in its respective class,LDAPControlSet. i want to understand that how does it create an empty list from std when nothing's there in its below constructors?? Moreover, the below constructors are the copy-constructors..

Please help!!

LDAPControlSet::LDAPControlSet(){
}

LDAPControlSet::LDAPControlSet(const LDAPControlSet& cs){
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet(&)" << endl);
    data=cs.data;
}

LDAPControlSet::LDAPControlSet(LDAPControl** controls){
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet()" << endl);
    if(controls != 0){
        LDAPControl** i;
        for( i=controls; *i!=0;i++) {
            add(LDAPCtrl(*i));
        }
    }
}

Does the class-declaration already have a member of type std::list ?
If so, The list is created there itself and doesn't require any explicit modifications.

I pretty-much did not understand your question very well. Would you mind rephrasing it .

I apologize adatapost, i have used BB codes now..

Sky Diploma,
I have rephrased my statements as well now..

i meant to ask that the class declaration does not have any member like std::list but only the typedef statement,
typedef std::list<LDAPCtrl> CtrlList;

the below constructors are actually the copy constructors

LDAPControlSet::LDAPControlSet(){
}
LDAPControlSet::LDAPControlSet(const LDAPControlSet& cs){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet(&)" << endl);
data=cs.data;
}

in the above code, where the 'data' comes from?

LDAPControlSet::LDAPControlSet(LDAPControl** controls){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet()" << endl);
if(controls != 0){
LDAPControl** i;
for( i=controls; *i!=0;i++) {
add(LDAPCtrl(*i));
}
}
}

Hello Sky Diploma

i confirm that the class-declaration doesnt have a member of type std::list, so how do I declare or create this list?

please help
Thanks.

Hey Post down the whole code or the class declaration just in case,

yeah sure, please refer the class LDAPControlSet below,

class LDAPControlSet {
    typedef CtrlList::const_iterator const_iterator;
    public :
        LDAPControlSet();

        LDAPControlSet(const LDAPControlSet& cs);

        LDAPControlSet(LDAPControl** controls);

        ~LDAPControlSet();

        size_t size() const ;

        bool empty() const;

        const_iterator begin() const;

        const_iterator end() const;

        void add(const LDAPCtrl& ctrl);

        LDAPControl** toLDAPControlArray()const ;
        static void freeLDAPControlArray(LDAPControl **ctrl);
    private :
        CtrlList data;
} ;

Well this answers it,

private:
CtrlList data;

This is the empty list that will be created, If I am not wrong, I think we have gone through the typedef definition of CtrlList in one of the other Threads that you have started :)

Many thanks Sky diploma. yes i got your point now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.