Conversion to non-scalar type problem

No responses yet....do I need to post more info? Apparently, I am trying to save something that is one type into a variable of another type and I am getting an error. Note the capital 'V' in vector in the error. I have no idea what is going on there. The error is in line 17 of main as shown. Please help.

Error:
 
17 std::vector<BoxMaker*, std::allocator<BoxMaker*> >' to non-scalar type `Vector<BoxMaker*>' requested 


Main Function
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <vector>
#include "StartMeUp.h"
#include "Multiplier.h"
#include "Stroustrup.h"
#include "MakeSmall.h"
#include "BoxMaker.h"
using namespace std;

vector<int> g_Masks;
int g_Small;

int main()
try{
      StartMeUp KickStart;
      Multiplier MultiBox(KickStart.GetMyHosts());
      vector<BoxMaker*> test = MultiBox.GetTheBoxSet();
      MakeSmall Shrinker( test );
   
    system("PAUSE");
    return 0;
}

catch (exception& e)
    {
        cerr << e.what() << endl;
        keep_window_open ("~1");
        return 1;
    }
catch (...) 
    {
        cerr << "exception \n";
        keep_window_open ("~2");
        return 2;
    }


Some Relevant Sections

Multiplier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef Multiplier_h
#define Multiplier_h
#include "Token_stream.h"
#include "BoxMaker.h"
#include <vector>
using std::vector;

class Multiplier
{
    public:
       Multiplier(vector<Token> hosts_in);
       vector<BoxMaker*> GetTheBoxSet();
    
    private:           
       vector<Token> hosts;
       vector<BoxMaker*> BoxSet;
};

#endif 


Multiplier cstor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "Multiplier.h"
#include "BoxMaker.h"
#include "Token_stream.h"
#include <vector>
using std::vector;


Multiplier::Multiplier(vector<Token> hosts_in):
                                             hosts(hosts_in)
{
    for (int i = 0; i<4; i++)
        {
            BoxSet.push_back(new BoxMaker(hosts, i));
        }
}


BoxMaker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef BoxMaker_h
#define BoxMaker_h
#include "SimpleBox.h"
#include "Token_stream.h"
#include <vector>

class BoxMaker
{
  public:
         BoxMaker (vector<Token> Hosts_in, int i);
         vector<SimpleBox*> GetMyBoxes();         
  private:
          vector<Token> theHosts;
          vector<SimpleBox*> myBoxes;
};

#endif 


BoxMaker cstor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "BoxMaker.h"
#include <vector>

BoxMaker::BoxMaker(vector<Token> Hosts_in, int i):
                                          theHosts(Hosts_in)
{   
       theHosts.push_back(i); 
       // add the i (indicitive of template) to the vector
       int  numOfSubnets;
      
       if ( (i == 0) || (i == 1) )
       //first and second BoxMakers created have no reserve networks
       {        
         numOfSubnets = theHosts.size()-2; //no reserve
       }
       else
       {
         numOfSubnets = theHosts.size()-1;  //reserve
       }
  
    
        for (int q = 0; q<numOfSubnets; q++)
    {
         myBoxes.push_back(new SimpleBox(theHosts));
    }
       
}


A BoxMaker Get file
1
2
3
4
5
6
7
8
9
10
11
12
#include "BoxMaker.h"
#include <iostream>
#include "SimpleBox.h"
using namespace std;


vector<SimpleBox*> BoxMaker::GetMyBoxes()
{
    return myBoxes;
}



MakeSmall.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef MakeSmall_h
#define MakeSmall_h
#include "SimpleBox.h"
#include "Token_stream.h"
#include "BoxMaker.h"
#include <vector>
//using std::vector;
using namespace std;

class MakeSmall
{
  public:
        MakeSmall(vector<BoxMaker*> Pass_in);
        vector<BoxMaker*> GetAltBoxSet();

 private:
         vector<BoxMaker*> BoxSet;
         int PureStack(vector<BoxMaker*> BoxSet);
         int SmallUpHigh(vector<BoxMaker*> BoxSet);
         int PureReserve(vector<BoxMaker*> BoxSet);
         int ReserveSmall(vector<BoxMaker*> BoxSet);
         int FigureMaxSNM(vector<SimpleBox*> myBoxes);
         vector<int> MaximumMasks; 
         

};
#endif


MakeSmall cstor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "MakeSmall.h"
#include "BoxMaker.h"
#include "SimpleBox.h"
#include <vector>
using namespace std;
//using std::vector;

//class BoxMaker;
//class SimpleBox;


MakeSmall::MakeSmall(vector<BoxMaker*> BoxSet_in):
                                                 BoxSet(BoxSet_in)
{
      vector<int> Masks;
      
      Masks.push_back(PureStack(BoxSet));
      Masks.push_back(SmallUpHigh(BoxSet));
      //Masks.push_back(PureReserve(BoxSet));
      //Masks.push_back(ReserveSmall(BoxSet));
      
      //g_Masks = Masks; //set the Maximum Masks set for each network to the global copy.
         
}
     
                    
Last edited on
There must be something interfering in the global namespace. I notice that "Stroustrup.h" is only included in main.cpp. What in it?
Stroustrup is only related to the try/catch block. It is from a text book and is only used in main.
Topic archived. No new replies allowed.