<div>Hi,</div><div><br></div><div>
                    I guess you could use a template with a std::vector: you don't need to define right away the type, if you create a template of it.
                </div><div><br></div><div>It should look something like that:</div><div><br></div><div>template<class B> class List {</div><div>std::vector<B> myList;</div><div>void insert (int pos, B elem);</div><div>}</div><div><br></div><div>template <class B> </div><div>void List::add (int pos, B elem) { </div><div>  myList.insert(myList.begin()+pos, elem);</div><div>}</div>
                <div><div><br></div><div>Then, wherever you'll use this class, you should define for which class B your class List should match (such as "List<int> intList;" or "List< std::vector<long> > longVectors;").</div><div><br></div><div>-- </div><div>Cristianno Martins</div></div>
                 
                <p style="color: #A0A0A8;">On Monday, 15 de April de 2013 at 07:13, B B wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi!</div><div>I want to implement a list (which operates like ArrayList in Java).</div><div><br></div><div>I can use ArrayType from llvm, but at creation time I have to specify</div><div>size so there is a problem when I want to extend it (I can reallocate</div><div>it ofc). Moreover I need to implement all the operations (inserting,</div><div>removing etc.) manually.</div><div><br></div><div>I though that maybe I can use std::vector, but there is another</div><div>problem - std::vector is a template class, so I have to specify type</div><div>before compiling it to llvm bytecode. Is there some solution to</div><div>specify that type dynamically?</div><div><br></div><div>What is the best method to implement such things in llvm?</div><div><br></div><div>I would be grateful for any solutions or tips.</div><div>_______________________________________________</div><div>LLVM Developers mailing list</div><div>LLVMdev@cs.uiuc.edu         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div><div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>