Solved

Error C3254 compiling template class

Posted on 2015-01-22
1
356 Views
Last Modified: 2015-01-22
Hi!

I have the following quite simple helper class to use with for_each to add 2D points to a 2D or 3D point vector. I have compiled this many times, but after some minor code change I suddenly get compiler error "error C3254: 'MyClass' : class contains explicit override '()' but does not derive from an interface that contains the function declaration" and can't see why? Any tips appreciated!
    template <class P>
    class solutionAdd
    {
    public:
      solutionAdd(std::vector<P>& solutions, const double elevation = 0.0) : 
         m_solutions(solutions), m_elevation(elevation) {}
      void operator()(const std::pair<double, Point2D>& breakPoint)
      {
        m_solutions.push_back(breakPoint.second);
      }
    private:
         std::vector<P>& m_solutions;
         double m_elevation;
    };
    template<> 
     void solutionAdd<Point3D>::operator()(const std::pair<double, Point2D>& breakPoint) 
    { 
      m_solutions.push_back(Point3D(breakPoint.second.GetX(), breakPoint.second.GetY(), m_elevation));
    }

Open in new window

I'm certainly overlooking something obvious here...
0
Comment
Question by:khun
1 Comment
 
LVL 8

Accepted Solution

by:
khun earned 0 total points
ID: 40564060
And as soon as I wrote this I found the error: I had moved this from outside the declaration of "MyClass" _into_ the class declaration...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now