for quite some time i struggle with old-as-c++ problem of separating the implementation of a templated function from the definition. C++0x' `extern` seem to be a solution for this, but i fail to apply it properly

my code:

`main.cpp`

```
#include <iostream>
#include <string>

#include "lexer.h"

int main(int argc, char const *argv[]) {
    std::string foo("foo");
    new lexer((foo.begin()),(foo.end()));
    return 0;
}

```

`lexer.h`

```
#ifndef lexer_h
#define lexer_h
class lexer {
    public:
    extern template<class InputIterator>
    lexer(InputIterator i, InputIterator end);
};
#endif //lexer_h

```

`lexer.cpp`

```
#include "lexer.h"
template<class InputIterator >
lexer::lexer(InputIterator i, InputIterator end) {
    //make it work
};

```

compiling with `g++ main.cpp lexer.cpp -std=c++0x`. I want to use object files later.

so how would it look fixed?