Compiler crashing template
-
I've been working on a small utility that needs to read/write Linux style configuration files. I have just started templating the class responsible for holding the file's content and I've run into a small problem. The following is a listing of the template declaration for the class.
// ...
template<
class Element,
class Traits = std::char_traits<Element>,
class Allocator = std::allocator<Element>,
class Container = std::map<std::basic_string<Element, Traits, Allocator>,
std::basic_string<Element, Traits, Allocator> >class basic_configuration {
// ...
};
// ...My hope was to allow for the container used for storing the key/value pairs (key=value) to be changeable via a template parameter. Unfortunately, the above code will not compile... it crashes the compiler (VC 6.0, SP5). Any suggestions on how I might go about fixing this? cheers, -B
-
I've been working on a small utility that needs to read/write Linux style configuration files. I have just started templating the class responsible for holding the file's content and I've run into a small problem. The following is a listing of the template declaration for the class.
// ...
template<
class Element,
class Traits = std::char_traits<Element>,
class Allocator = std::allocator<Element>,
class Container = std::map<std::basic_string<Element, Traits, Allocator>,
std::basic_string<Element, Traits, Allocator> >class basic_configuration {
// ...
};
// ...My hope was to allow for the container used for storing the key/value pairs (key=value) to be changeable via a template parameter. Unfortunately, the above code will not compile... it crashes the compiler (VC 6.0, SP5). Any suggestions on how I might go about fixing this? cheers, -B
Here is how, for anyone who's interested.
// ...
template<
class Element,
class Traits = std::char_traits<Element>,
class Allocator = std::allocator<Element>struct MyContainer {
typedef std::basic_string<Element, Traits, Allocator> string_type;
typedef std::map<string_type, string_type> type;
};
// ...
template<
class Element,
class Traits = std::char_traits<Element>,
class Allocator = std::allocator<Element>,
class Container = MyContainer::typeclass basic_configuration {
// ...
};
// ...cheers, -B