c++ - How to initialize a static const set<string> in implementation file? -


my initialisation of static const set<string> appears incorrect, i'd appreciate 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 yields error: error: conversion ‘const string* {aka const std::basic_string<char>*}’ non-scalar type ‘const std::set<std::basic_string<char> >’ requested

can tell me correct way initialise set?

take out =. invoke constructor.

const set<string> obj::keywords (kw,kw + sizeof(kw)/sizeof(kw[0])); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -