i am struggling with an error which i get when trying to compile my C++ Programm which is using templates and typenames. Here is the Code which i have problems with:
template <typename Key, size_t N = 10>
class ADS_set {
public:
class Iterator;
using key_type = Key;
.
.
.
private:
std::pair<Iterator, bool> next_idx(Bucket &bkt, const_reference key, bool split);
}; // End of class
template <typename Key, size_t N>
std::pair<ADS_set<Key, N>::Iterator, bool> ADS_set<Key, N>::next_idx(Bucket &bkt, const_reference key, bool split) {
No, the problem lies on the definition of my next_idx Method. Somehow i do not define the template parameters of my std::pair correctly as far as I do understand. I would ask you if you could provide me a correct solution and an explanation why this was wrong so that i could possibly understand this better in the future!
The error(s) which i get do say the following:
ADS_set.h:428:42: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _T1, class _T2> struct std::pair’
std::pair<ADS_set<Key, N>::Iterator, bool> ADS_set<Key, N>::next_idx(Bucket &bkt, const_reference key, bool split) {
^
ADS_set.h:428:42: note: expected a type, got ‘ADS_set<Key, N>::Iterator’
ADS_set.h:428:44: error: prototype for ‘int ADS_set<Key, N>::next_idx(ADS_set<Key, N>::Bucket&, ADS_set<Key, N>::const_reference, bool)’ does not match any in class ‘ADS_set<Key, N>’
std::pair<ADS_set<Key, N>::Iterator, bool> ADS_set<Key, N>::next_idx(Bucket &bkt, const_reference key, bool split) {
Thanks a lot for you help!