Can gflags be used to control c++ class type

  c++

I want to control the type of class member through parameters.
the code looks like:

namespace foo {
using MapType = FLAGS_enable_unordered ? std::unordered_map<int, int> : std::map<int, int>;

class MyTest {
  public:
    MyTest() {...};

  private:
    MapType map_;
};
} //  namespace foo

The compilation result shows that FLAGS_enable_unordered is not recognized, I think it may be that FLAGS_enable_unordered should be used in function.

Is there a way to use FLAGS_enable_unordered to control the MapType?

Source: Windows Questions C++

LEAVE A COMMENT