+ Reply to Thread
Results 1 to 3 of 3

Thread: What is Explicit Instantiation?

  1. #1

    What is Explicit Instantiation?

    Hi All,

    What is Explicit Instantiation of template?

    Provide example.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    38
    Explicit instantiation lets you create an instantiation of a templated class or function without actually using it in your code.


    Example:

    Code:
    template<typename T, int SIZE>
    class CStack
    {
    	T m_T[SIZE] ;
    public:
    	CStack(const T &objT, int SIZE) {} ;
    } ;
    
    template class CStack<int, 10> ;
    Note:
    Above example depicts that it explicitly instantiate a template for CStack class with 'int' data type and size 10.

  3. #3
    Thanks for the explanation.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts