Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6634437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:55:46+00:00 2026-05-25T22:55:46+00:00

I have the following header file: #ifndef DATABASE_H #define DATABASE_H #include <vector> #include <iostream>

  • 0

I have the following header file:

#ifndef DATABASE_H
#define DATABASE_H


#include <vector>
#include <iostream>
#include <string>

#include "record.h"

using namespace std;

template <class value>
class Database {

  public:

    void write (ostream& out, DBScope scope) const;

    Database <value>() {};
    ~Database();

  private:

    vector <Record<value> > records;

};

#include "database.tem"

#endif

database.tem:

template <class value>
void Database<value>::write (ostream& out, DBScope scope) const {

 class vector <Record <value> >::iterator itr = records.begin();

 switch (scope) {

    case AllRecords:
      for (; itr != records.end(); itr++) out << itr;
      break;
    case SelectedRecords:
      for (; itr != records.end(); itr++) {
        if (itr.isSelected) out << itr;
      }
      break;

  }
}

I was running this header a long with another file and produced this error message, noting that in my header file I have another file called database.tem which is #include "database.tem" into my database.h file:

    database.tem: In member function 'void Database<value>::write (std:: ostream&, DBScope) const [with value = int]':
database.tem: In member function 'void Database<value>::write(std::ostream&, DBScope) const [with value = int]':
interactive.cpp:285:   instantiated from 'bool WriteCommand(Database<value>&) [with value = int]'
interactive.cpp:127:   instantiated from 'bool DispatchCommand(CommandT, Database<value>&) [with value = int]'
interactive.cpp:74:   instantiated from 'void MainLoop(Database<value>&) [with value = int]'
interactive.cpp:99:   instantiated from here
database.tem:6: error: conversion from '__gnu_cxx::__normal_iterator<const Record<int>*, std::vector<Record<int>, std::allocator<Record<int> > > >' to non-scalar type '__gnu_cxx::__normal_iterator<Record<int>*, std::vector<Record<int>, std::allocator<Record<int> > > >' requested
interactive.cpp:285:   instantiated from 'bool WriteCommand(Database<value>&) [with value = int]'
interactive.cpp:127:   instantiated from 'bool DispatchCommand(CommandT, Database<value>&) [with value = int]'
interactive.cpp:74:   instantiated from 'void MainLoop(Database<value>&) [with value = int]'
interactive.cpp:99:   instantiated from here
database.tem:11: error: no match for 'operator<<' in 'out << itr'

I have no idea what this messsage is talking about, can someone help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:55:47+00:00Added an answer on May 25, 2026 at 10:55 pm

    The first error has to do that the method is const, hence records is const, and reconds.begin() returns a const_iterator.

    template <class value>
    void Database<value>::write (ostream& out, DBScope scope) const {
    
     vector <Record <value> >::const_iterator itr = records.begin();
    

    The second error means that you probably meant to dereference the iterator:

    for (; itr != records.end(); itr++) out << *itr;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a header file... #include <SFML\Graphics.hpp> #include <SFML\Graphics\Drawable.hpp> #include <SFML\System.hpp> #include <iostream> #ifndef
I have the following header file: #ifndef CLASSES_H #define CLASSES_H class Mouse // Handles
I have the following in header file. namespace silc{ class pattern_token_map { /* Contents
Consider the following header file example: shared_example.h #ifndef SHARED_EX #define SHARED_EX const int Shared_Int
I have C header file containing the following type definition: // example.h typedef struct
I have setup the following header file to create a Stack which uses an
I have the following chunk of a header file BKE_mesh.h: /* Connectivity data */
If I have the following in a header file: Foo.h Foo { public: static
I have the following header file: typedef struct my_data my_data_t; my_data_t* new_my_data(void); void free_my_data(my_data_t*
I have a header file port.h, port.c, and my main.c I get the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.