Loki VC 6.0 Port or how to produce C1001 - Internal Compiler Errors
-------------------------------------------------------------------
Version: 0.5d
Introduction/Compatibility:
---------------------------
This is a partial MSVC 6.0 Sp5 compatible port of Andrei Alexandrescu's excellent Loki Library.
Because I could not retain the originial interface in all places, this port is not
compatible to the original library and therefore code using this port *cannot* generally be
used together with the original lib.
This is, of course, a great pity.
So if you know of a complete and full interface-compatible VC 6.0
port or if you know how to improve this port, please let me know.
Contact:
--------
For any suggestions, bug reports, comments and questions please email me to
[email protected]
Using this port:
----------------
To use this port, simply extract the files from the archive, give your compiler access to
their path, and include them appropriately in your code via #include.
If you use the small object allocator directly or indirectly (through the Functor class)
you must add SmallObj.cpp to your project/makefile.
If you use Singletons with longevity you must add Singleton.cpp to your project/makefile.
Fixes:
------
Mar 21, 2003:
-------------
* In MultiMethods.h: Added a new explicit template argument specification (ETAS)-workaround
for FnDispatcher::Add which is more compliant with other
ETAS-workarounds used in this port.
Mar 20, 2003:
-------------
* In MultiMethods.h: Fixed bugs in FnDispatcher and FunctorDispatcher.
Fixing FnDispatcher led to an Interface change (see section "Interface changes").
Mar 08, 2003:
-------------
* In HierarchyGenerators.h: implemented transparent workaround for
'explicit template argument specification for nonmeber functions'-bug.
The Field-Functions can now be called as in the original lib.
Mar 06, 2003:
-------------
* In SmartPointer.h: Added helper-macros for convenient specialization
of std::less for Smart-Pointers.
* I found a way to use void as a default value for template parameters.
Therefore I changed MultiMethods.h and Visitor.h accordingly.
Feb 2003:
---------
* created new versions of Functor.h, Visitor.h and MultiMethods.h that
now can handle void return types transparently.
* ported SmartPtr's Ownership-Policy RefCountedMT
* Added isFunctionPointer to TypeTraits.
* Replaced all pointer-type dummy-parameters needed as a workaround
for VC's 'explicit template argument specification'-bug with Typ2Type-dummy
parameters.
* fixed the problems with BindFirst (Functor.h) that led to
C1001-Internal compiler errors.
* fixed numerous other bugs.
Jan 30, 2003:
-------------
* In TypeTraits.h: Fixed bugs in TypeTraits' scalar and array detection.
const and volatile detection is now based on techniques from boost's type traits
(see http://www.boost.org/libs/type_traits/)
Added Enum- and pointer-to-member-function-detection code.
Thanks to M. Yamada.
Jan 12, 2003:
-------------
* changed the signature of SmallObject's op new. Now it
matches the corresponding op delete.
Thanks to M.Yamada for the hint and the solution.
Dec 08, 2002:
-------------
* In HierarchyGenerators.h: Sergey Khachatrian reported a bug
in GenScatterHierarchy when used with a typelist containing
equal types (e.g. GenScatterHierarchy<TYPELIST_2(int, int), UnitWrapper>
resp. Tuple<TYPELIST_2(int, int)>)
Fixing the bug I found another MSVC6-Problem in the Field-function.
The workaround for this problems results in an interface change.
please refer to the section "Interface changes" below for further information.
Dec 03, 2002
-------------
* In MSVC6Helpers.h: The original version failed to qualify some types from the
Private-Namespace.
Thanks to Adi Shavit for pointing that out
* In Threads.h: Changed wrong ctor/dtor names in ObjectLevelLockable.
Thanks to Adi Shavit for pointing that out
Nov 19, 2002:
-------------
* In SmartPtr.h: Changed template ctors. See Notes.
Notes:
------
The original Loki Lib uses some pretty advanced (resp. new) C++ features like:
A. partial template specialization.
B. template template parameters.
C. explicit template argument specification for member- and nonmeber functions.
D. covariant return types.
E. Template parameters with default type void
F. return statements with an expression of type cv void in functions with a return type of cv void.
Unfortunately the MSVC 6.0 supports neither of them.
A. I used various techniques to simulate partial template specialization. In some cases
these techniques allowed me to retain the original interfaces but often that was not
possible (or better: i did not find a proper solution). In any case it led
to increasing code complexity :-)
B. One way to simulate template template parameters is to replace the template class with
a normal class containing a nested template class. You then move the original functionality
to the nested class.
The problem with this approach is MSVC's 'dependent template typedef bug'.
MSVC 6.0 does not allow something like this:
[code]
template <class APolicy, class T>
struct Foo
{
// error C2903: 'In' : symbol is neither a class template nor a function template
typedef typename APolicy::template In<T> type;
};
[/code]
To make a long story short, I finally decided to use boost::mpl's apply-technique to
simulate template template parameters. This approach works fine with MSVC 6.0. But be warned,
this technique uses not valid C++.
Of course, replacing template template parameters always results in some interface changes.
C. I added dummy-Parameters to (Member-)Functions that depend on explicit template
argument specification. These dummy-Parameters help the compiler in deducing the template
parameters that otherwise need to be explicitly specified.
Example:
[code]
struct Foo
{
template <class T>
T Func();
};
[/code]
becomes
[code]
struct Foo
{
template <class T>
T Func(Type2Type<T>);
};
[/code]
in this port.
Update:
-------
The MSVC 6.0 sometimes does not overload normal functions depending
on explicit argument specification correctly (see: Microsoft KB Article - 240871)
The following code demonstrates the problem:
[code]
template <unsigned i, class T>
void BugDemonstration(T p)
{
printf("BugDemonstration called with i = %d\n", i);
}
int main()
{
GenScatterHierarchy<TYPELIST_3(int, int, int), TestUnitWrapper> Bla;
// will always print: "BugDemonstration called with i = 2";
BugDemonstration<0>(Bla);
BugDemonstration<1>(Bla);
BugDemonstration<2>(Bla);
}
[/code]
Fortunately there is a transparent workaround for this problem. Simply add
a dummy-parameter with a proper default value:
[code]
template <unsigned i, class T>
void BugDemonstration(T p, Int2Type<i>* = (Int2Type<i>*)0)
{
printf("BugDemonstration called with i = %d\n", i);
}
int main()
{
GenScatterHierarchy<TYPELIST_3(int, int, int), TestUnitWrapper> Bla;
// will now work correctly
BugDemonstration<0>(Bla);
BugDemonstration<1>(Bla);
BugDemonstration<2>(Bla);
}
[/code]
Unfortunately adding dummy-parameters does not always work.
For example for one of FnDispatcher's
没有合适的资源?快使用搜索试试~ 我知道了~
本方法采用pca进行特征提取,knn分类器进行人脸识别
共171个文件
h:116个
cpp:12个
root:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 6 下载量 181 浏览量
2022-03-15
11:25:05
上传
评论 2
收藏 276KB ZIP 举报
温馨提示
本方法采用pca进行特征提取,knn分类器进行人脸识别。
资源推荐
资源详情
资源评论
收起资源包目录
本方法采用pca进行特征提取,knn分类器进行人脸识别 (171个子文件)
SmallObj.cpp 14KB
SmallObj.cpp 14KB
SmallObj.cpp 14KB
SmallObj.cpp 14KB
Test.cpp 4KB
HeaderGen.cpp 4KB
Singleton.cpp 2KB
Singleton.cpp 2KB
Singleton.cpp 2KB
Singleton.cpp 2KB
Singleton.cpp 685B
SmallObj.cpp 675B
Entries 1KB
Entries 1KB
Entries 1KB
Entries 1KB
Entries 1007B
Entries 741B
Entries 281B
Entries 39B
Entries 3B
Functor.h 94KB
FunctorOld.h 78KB
Functor.h 57KB
Functor.h 49KB
Functor.h 49KB
Typelist.h 42KB
SmartPtr.h 42KB
Typelist.h 40KB
SmartPtr.h 39KB
SmartPtr.h 37KB
SmartPtr.h 36KB
Typelist.h 34KB
Typelist.h 33KB
MultiMethods.h 26KB
Variant.h 24KB
HierarchyGenerators.h 17KB
TypeTraits.h 16KB
MultiMethods.h 16KB
Singleton.h 15KB
Visitor.h 15KB
VisitorOld.h 15KB
MultiMethods.h 15KB
Singleton.h 15KB
Singleton.h 15KB
MultiMethods.h 14KB
SmartPtrTest.h 14KB
Singleton.h 14KB
TypeTraits.h 13KB
HierarchyGenerators.h 13KB
AssocVector.h 12KB
AssocVector.h 12KB
AssocVector.h 11KB
AssocVector.h 11KB
AssocVectorTest.h 11KB
TypeTraits.h 11KB
Visitor.h 10KB
TypeTraits.h 10KB
HierarchyGenerators.h 9KB
TypeManip.h 9KB
HierarchyGenerators.h 9KB
Threads.h 9KB
TypeManip.h 9KB
TypeManip.h 9KB
TypeManip.h 9KB
TypelistTest.h 8KB
AbstractFactory.h 8KB
SmallObj.h 7KB
Visitor.h 7KB
Visitor.h 7KB
SmallObj.h 7KB
SmallObj.h 7KB
DataGenerators.h 6KB
MSVC6Helpers.h 6KB
SmallObj.h 6KB
Threads.h 6KB
Threads.h 6KB
Threads.h 6KB
AbstractFactory.h 6KB
AbstractFactory.h 6KB
AbstractFactory.h 6KB
Factory.h 5KB
Factory.h 5KB
Factory.h 5KB
SingletonTest.h 5KB
Factory.h 5KB
UnitTest.h 4KB
TypeManipTest.h 4KB
MinMax.h 4KB
TypeTraitsTest.h 4KB
LokiTypeInfo.h 3KB
DataGenerators.h 3KB
LokiTypeInfo.h 3KB
LokiTypeInfo.h 3KB
LokiTypeInfo.h 3KB
FactoryTest.h 3KB
SmallObjectTest.h 3KB
DataGenerators.h 3KB
VC_Alignment.h 3KB
FunctorTest.h 3KB
共 171 条
- 1
- 2
且行好事莫问前程
- 粉丝: 2w+
- 资源: 443
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页