Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualkloffy

Posted 07 April 2013 - 11:52 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation (as mentioned by SiCrane). I think the usual syntax would be something like:

template class GENERIC_STACK<int>;

 

Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...


#4kloffy

Posted 07 April 2013 - 11:51 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:

template class GENERIC_STACK<int>;

 

Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...


#3kloffy

Posted 07 April 2013 - 11:51 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:
template class GENERIC_STACK<int>;
Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...

#2kloffy

Posted 07 April 2013 - 11:50 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:
template class GENERIC_STACK<int>;
Edit: "Method 3" is generally done like AllEightUp described...

#1kloffy

Posted 07 April 2013 - 11:45 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation (as mentioned by SiCrane). I think the usual syntax would be something like:
template class GENERIC_STACK<int>;

PARTNERS