I'm  making a library to build and manage a website. I want to control what gets to be inserted. For example I don't want to be able to insert <foo bar=i></foo> as xml builders allow. I'm working with microcontrollers (currently with esp8266ex) that has support for WiFi and can act as a webserver. As you may or may not know, managing a complex web site in c++ is not easy. For now, as far as I know, everybody is building a webpage using string +=site. For simple projects that's fine, but as you start getting into multiple dynamic pages it gets harder. This is the end result I need (or similar):node<dataType::div> d_div;d_div.addParameter<param::_class>(div1);d_div.addParameter<param::name>('c');d_div.addParameter<param::id>(34);and this is the code that I've written to achieve that:namespace dataType {    typedef enum {a,div} type;}namespace param {    typedef enum {name, id, _class} param;}template<param::param N>struct helper {    static void f();   };template<>struct helper<param::name> {    static void f(char c) {std::cout << c << std::endl;}};template<>struct helper<param::id> {    static void f(int i) {std::cout << i << std::endl;}};template<>struct helper<param::_class> {    static void f(std::string s) {std::cout << s << std::endl;}};template <dataType::type T>class node {public:    template <param::param P>    void addParameter(int i){        helper<P>::f(i);    }    template <param::param P>       void addParameter(char c){        helper<P>::f(c);    }    template <param::param P>       void addParameter(std::string s){        helper<P>::f(s);    }};Is this a good approach? Is there a way to improve this? Or am I doing this all wrong? As you may or may not know, in HTML each tag supports global attributes and (if it has) specific attributes that only that tag supports. If I take the approach that Quuxplusone suggested some problems will arise.node d_div = node(div).setClass(div1).setName(c).setId(34);having node(div) would allow any tag to be inserted - solution: enum and/or a bunch of if elsehaving a specific method for each tag will greatly increase the code size. (There are currently 173 attributes in total)as mentioned above, each tag has global and specific attributes. How would i control that? ps. The code above does indeed compiles, so you can test it.  
Using templates and function overloads to set DOM attributes
c++;object oriented;template;dom;overloading