OgrePrerequisites.h
int getMostOccuring(int array[], int length)
{
int current_number;
int current_count = 0;
int most_occuring_number;
int most_occuring_count = 0;
for (int i = 0; i < length; i++)
{
current_number = array[i];
current_count = 0;
for (int j = i; j < length; j++)
{
int test_number = array[j];
if (test_number == current_number)
{
current_count ++;
if (current_count > most_occuring_count)
{
most_occuring_number = current_number;
most_occuring_count = current_count;
}
}
}
}
return most_occuring_number;
}
OgreLogManager.h
#define _OgreExport __declspec( dllexport )
template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
struct map
{
typedef typename std::map<K, V, P, A> type;
typedef typename std::map<K, V, P, A>::iterator iterator;
typedef typename std::map<K, V, P, A>::const_iterator const_iterator;
}
class _OgreExport LogManager
{
protected:
typedef map<String, Log*>::type LogList;
/// A list of all the logs the manager can access
LogList mLogs;
};
使用LogManager
,但是当我构建项目时,我没有收到任何C4251警告:
std::map
我想知道Ogre如何消除**class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class**
警告?
答案 0 :(得分:0)
他们disable明确警告#pragma warning某些警告。正如在MSDN上提到的,通常的方法是使用
的组合在本地禁用警告#pragma warning( push )
#pragma warning( disable : 4705 )
// Some code
#pragma warning( pop )
恢复原始警告设置。它们会在OgreHeaderSuffix.h中恢复警告设置,因此仅对库代码禁用这些警告。