Once all the support work is finished, you can instantiate a stream class template on your type and begin to use it--well, not quite. Because the new stream requires the new facets you've defined, you must first create a new locale containing these facets and then imbue that locale on your stream. You can do this as follows:
typedef std::basic_fstream<Echar,Etraits> Estream; // 1
std::locale Eloc(std::locale(std::locale(),
new Ecodecvt),new Ectype); // 2
Estream foo("foo.txt"); // 3
foo.imbue(Eloc); // 4
Now we're ready to insert Echars into the stream and read them back in:
Echar e[10]; Estream::pos_type pos = foo.tellp(); //1 foo << 10; //2 foo.seekg(pos); //3 foo >> e; //4