Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Silly_con

Templates Vector class error

This topic is 5737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

why when I make my Vector class templated (that works untemplated) get this error in a lot of functions error C2955: ''TVector3'' : use of class template requires template argument list tvector3.h(115) : see declaration of ''TVector3''
  
template <class _T>
class TVector3 { ... }

// TVector3 function

const void TVector3::LoadUnit() {
	x = 1.0;
	y = 1.0;
      z = 1.0;
};
  

Share this post


Link to post
Share on other sites
Advertisement
You are forgetting one line above the function. You should place above EACH function template aswell. Code should look like this:


  
template <class _T>
const void TVector3::LoadUnit() {
x = 1.0;
y = 1.0;
z = 1.0;
};


Also, why are you returning a const void?!?! void cannot contain a pointer, so void alone is enough....

Sand Hawk

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks!, const its because I am accustomed to putting it

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have to put template <class _T> before each function/operator overloading ? in declaration only or too in definition?
sorry for too much questions, I am starting with templates

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have solved the errors now, no more help needed

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!