workaround for msvc10 stl bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@34858 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2010-07-11 20:27:26 +00:00
parent 2d1d9631a2
commit 7251a3a340
4 changed files with 72 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "support/textutils.h" #include "support/textutils.h"
#include "support/docstring.h" #include "support/docstring.h"
#include "support/docstream.h"
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>

View File

@ -23,6 +23,10 @@ using namespace std;
using lyx::ucs4_codeset; using lyx::ucs4_codeset;
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
std::locale::id numpunct<lyx::char_type>::id;
#endif
namespace { namespace {
// We use C IO throughout this file, because the facets might be used with // We use C IO throughout this file, because the facets might be used with

View File

@ -17,6 +17,14 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
// Ugly workaround for MSVC10 STL bug
// http://connect.microsoft.com/VisualStudio/feedback/details/572376/msvc10-c-std-numpunct-has-a-hardcoded-dllimport-in-definition
// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit
// so we can't import it and must define it but then the compiler complains.
#include "support/numpunct_lyx_char_type.h"
#endif
namespace lyx { namespace lyx {
class iconv_codecvt_facet_exception : public std::exception { class iconv_codecvt_facet_exception : public std::exception {

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
/**
* \file numpunct_lyx_char_type.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Peter Kümmel
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_NUMPUNCT_LYX_CHAR_TYPE_H
#define LYX_NUMPUNCT_LYX_CHAR_TYPE_H
#include <locale>
namespace std
{
template<>
class numpunct<lyx::char_type> : public numpunct<char>
{
public:
typedef lyx::char_type char_type;
typedef basic_string<lyx::char_type> string_type;
static locale::id id;
explicit numpunct(size_t __refs = 0) : numpunct<char>(__refs)
{}
char_type decimal_point() const
{ return numpunct<char>::decimal_point(); }
char_type thousands_sep() const
{ return numpunct<char>::thousands_sep(); }
string grouping() const
{ return numpunct<char>::grouping(); }
string_type truename() const
{ return lyx::from_ascii(numpunct<char>::truename()); }
string_type falsename() const
{ return lyx::from_ascii(numpunct<char>::falsename()); }
protected:
virtual ~numpunct();
};
}
#endif