//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <boost/tokenizer.hpp>
class Base
{
public:
typedef boost::char_separator<char> sep_type_t;
typedef boost::tokenizer<sep_type_t> tokenizer_t;
Base(std::string s) : sep_(";"),
tok_(s,sep_),
i_(tok_.begin())
{
}
std::string nextToken()
{
if (i_!=tok_.end())
return *i_++;
else
return "";
}
protected:
sep_type_t sep_;
tokenizer_t tok_;
tokenizer_t::iterator i_;
};
class Sub : public Base
{
public:
Sub(std::string s) : Base(s)
{
std::string t = nextToken();
std::string u = nextToken();
std::string v = nextToken();
}
void doSomething()
{
int x = 0;
x +=1;
}
};
int main (int argc, char **argv)
{
Sub x("ASIF;Sohail;Kaleem;Maryam;Irfan;Khurram");
x.doSomething();
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This code is compiling and running fine on GCC 4.6.0 / Fedora 15 / 64-bit. I hope somebody here will help me out on this.