Попробуйте это:
public class T28Regex {
public static void main(String[] args) {
String[] strings = { "<someother string without *>:abc\t<some other string without \t>",
"<someother string without *>:abc,cde\t<some other string without \t>",
"<someother string without *>:abc,efg,cde\t<some other string without \t>",
"<someother string without *>:abc,cde\t<some other string without \t>" };
for (String s : strings) {
System.out.println(s.substring(0, s.indexOf(":")) + "|"
+ s.substring(s.indexOf(":") + 1, s.indexOf("\t", s.indexOf(":"))).replaceAll(",", "|")
+ s.substring(s.indexOf("\t", s.indexOf(":"))));
}
}
}
При инстанцировании шаблона полностью - у Вас есть полный тип. Это не отличается от любых других типов. Необходимо включать заголовок для B
и также время компиляции связываясь в с a lib
файл или динамично загружает dll для соединения с определением.
Сделайте, чтобы Вы прочитали эту статью: http://support.microsoft.com/kb/168958?
Вот краткий обзор того, что я протестировал (и он работал):
Создайте фиктивный проект DLL
template_export_test
файл: template_export_test.h
#ifndef EXP_STL
#define EXP_STL
#endif
#ifdef EXP_STL
# define DECLSPECIFIER __declspec(dllexport)
# define EXPIMP_TEMPLATE
#else
# define DECLSPECIFIER __declspec(dllimport)
# define EXPIMP_TEMPLATE extern
#endif
EXPIMP_TEMPLATE template class DECLSPECIFIER CdllTest<int>;
файл: template_export_test.cpp
template<class T>
CdllTest<T>::CdllTest(T t)
: _t(t)
{
std::cout << _t << ": init\n";
}
Создайте тестовое приложение
driver
template_export_test.lib
template_export_test.lib
template_export_test.h
в основном cpp файле #include "c:\Documents and Settings\...\template_export_test.h"
using namespace std;
int main(int argc, char** argv) {
CdllTest<int> c(12);
}
Кажется, даже при явной инсталляции шаблона могут возникнуть проблемы, которые приведут к ошибкам во время выполнения. Взгляните на эту интересную статью на C4251 (особенно на «Заключение»).