Accessing static member locale::id


The following code snippet is an example that shows how to use locale::id when writing an application on top of the Standard Template Library (STL).When defining a class base_facet inherited from locale::facet  in a header file, declare a static method GetFacetLocaleId() instead of the member variable id.
 
//b_facet.h 
class base_facet : public locale::facet 
{ 
public: 
static locale::id& 
GetFacetLocaleId();       // in place of static locale::id
id; 
};

In the source file define the method  GetFacetLocaleId().

//b_facet.cpp

locale::id base_facet_id; 
locale::id& 
base_facet::GetFacetLocaleId()
{ 
return base_facet_id; 
}

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top