Click here to Skip to main content
15,888,048 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//Code

XML
using namespace std;

template <class VECTOR>
class ModelCalc
{

public:
    typedef VECTOR                   vector_type;
    typedef typename vector_type::value_type  value_type;

public:

    ModelCalc(const vector_type& xValues,
        const vector_type& distances,
        const value_type&   length
        );


    const vector_type& distances() const;

    const value_type& length() const;

private:

    vector_type m_xValues;
    vector_type m_distances;
    value_type  m_length;

};


template <class VECTOR>
ModelCalc<VECTOR>::ModelCalc(const vector_type& xValues,
                                       const vector_type& distances,
                                       const value_type& length
                                       ):
m_xValues(xValues),
m_distances(distances),
m_length(length)
{

};

template <class VECTOR>
const ModelCalc<VECTOR>::vector_type& ModelCalc<VECTOR>::distances() const
{
    return m_distances;
};

template <class VECTOR>
const ModelCalc<VECTOR>::value_type& ModelCalc<VECTOR>::length() const
{
    return m_length;
};



//compiling report
warning C4346: “ModelCalc<vector>::vector_type”:
VB
error C2143: syntax error : missing";"(in front of"&")
error C4430: 
Posted

1 solution

You should use typename for ModelCalc<vector>::vector_type</vector>, since this is not a type.

C++
template <class vector="">
const typename ModelCalc<vector>::vector_type& ModelCalc<vector>::distances() const
{
   return m_distances;
};

template <class vector="">
const typename ModelCalc<vector>::value_type& ModelCalc<vector>::length() const
{
   return m_length;
};</vector></vector></class></vector></vector></class>
 
Share this answer
 
Comments
CPallini 8-Jan-14 3:42am    
Thank you for your good and quick answer!

[Carlo on behalf of hotrolling]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900