Hi,

I was doing a program in C++ where I simulate a Java's ArrayList...

template <class T>
class Duo
{
    public:
        Duo *next;
T element;
    
        Duo(T el,Duo *sig)
        {
            element=el;
            next=sig;
        }
        ~Duo() {};
   Duo* getNext() {return next;}
   T getElement() {return element;}
   void setNext(Duo *myNext) {next=myNext;}
        void setElement(T el){element=el;}
};


template <class T>
class ArrayList
{
    public:
   Duo <T>*Ptr_First;
   Duo <T>*Ptr_Last;
    
   ArrayList(){Ptr_First = Ptr_Last = NULL;};
            ~ArrayList(){}

     void insert(T el);
             std::pair<T, int> get(int index);
        
};

template <class T>
void ArrayList<T>::insert(T elem) {
    Duo<T> *ptr_walker = Ptr_First;
    Duo<T> *ptr_cache;
    if (Ptr_First == NULL && Ptr_Last == NULL) {
       Duo<T> *Ptr_temp = new Duo<T>(elem, NULL);
       Ptr_First = Ptr_temp;
       Ptr_Last = Ptr_temp;
    }
    else {
        while (ptr_walker->getNext() != NULL)
            ptr_walker = ptr_walker->getNext();
        ptr_cache = ptr_walker;
        Duo<T> *Ptr_temp = new Duo<T>(elem, NULL);
Ptr_Last = Ptr_temp;
        ptr_walker->setNext(Ptr_temp);
    }
}
template <class T>
std::pair<T, int> ArrayList<T>::get(int index)
{
    Duo<T> *ptr_walker;
    std::pair <T, int> receiver;
    receiver.first = ptr_walker->getElement();
    receiver.second = 0;
    bool found = false;
    if ((Ptr_First == NULL) && (Ptr_Last == NULL))
        return  receiver;
    else {
        ptr_walker = Ptr_First;
        for (int i = 0; i<index; i++) {
            ptr_walker = ptr_walker->getNext();
        }
        receiver.first = ptr_walker->getElement();
        receiver.second = 1;
        return receiver;
    }
}

The thing is that I instanciated an ArrayList object and called the "insert" method and I received an error from boost::mutex AND boost::noncopyable!! and I am not using them at all!!
This is the code that generates the error:

        ArrayList<ObjectA> myArrayListA;
        ObjectA myObjectA;
        myArrayListA.insert(myObjectA);

and the errors I got:

mkdir -p build/Debug/GNU-MacOSX
rm -f build/Debug/GNU-MacOSX/main.o.d
g++ -pthreads -lboost_thread   -c -g -fPIC  -MMD -MP -MF build/Debug/GNU-MacOSX/main.o.d -o build/Debug/GNU-MacOSX/main.o main.cpp
/usr/local/include/boost/noncopyable.hpp: In copy constructor 'boost::mutex::mutex(const boost::mutex&)':
In file included from main.cpp:23:
/usr/local/include/boost/noncopyable.hpp:27: error: 'boost::noncopyable_::noncopyable::noncopyable(const boost::noncopyable_::noncopyable&)' is private
/usr/local/include/boost/thread/pthread/mutex.hpp:31: error: within this context
ObjectA.h: In copy constructor 'ObjectA::ObjectA(const ObjectA&)':
ObjectA.h:18: note: synthesized method 'boost::mutex::mutex(const boost::mutex&)' first required here 

Any Ideas why am I receiving this errors?

THANKS!!

Dann