How to initialize a static const set<string> in implementation file?
c++, constants, set, static
Solution
Take out the `=`. Just invoke the constructor.
const set<string> obj::keywords (kw,kw + sizeof(kw)/sizeof(kw[0]));
Problem
My initialisation of a `static const set<string>` appears to be incorrect, I'd appreciate your guidelines on this: `obj.h`: ``` class obj { ... private: static const set<string> keywords; ... } ``` `obj.cpp`: ``` const string kw[] = {"GTR","LTR","LEQ","GEQ","NEQ","SQRT","sqrt"}; const set<string> obj::keywords = (kw,kw + sizeof(kw)/sizeof(kw[0])); ``` But this yields the error: `error: conversion from ‘const string* {aka const std::basic_string<char>*}’ to non-scalar type ‘const std::set<std::basic_string<char> >’ requested` Can somebody tell me the correct way to initialise this set?