My test program was as follows:
[Code]
// fly.cpp : main project file.
#include "stdafx.h"
#include <string>
#include <iostream>
#include <vector>
#include <fstream>
#include <iterator>
#include <algorithm>
#include
#include
using namespace std;
vector vec;
//vector<string> vec;
struct Insert {
void operator()(string s) {
vec.push_back(boost::flyweight<string>(s));
//vec.push_back(s);
}
};
void Test() {
fstream f("d:\\bible12.txt", ios_base::in); // A large text file!
{
boost::progress_timer t;
for_each(istream_iterator<string>(f),
istream_iterator<string>(), Insert());
}
}
int main(int argc, char* argv[])
{
Test();
cout << vec.size() << endl;
getchar();
copy(vec.begin(), vec.begin() + 200, ostream_iterator(cout, " "));
getchar();
return 0;
}
[/Code]
Using the boost_1_35_0 svn library download and Visual C++ 2008 Express
edition.
Originally compiled as a CLR program. Recompiling using native Win32
still gives a crash during program termination - in
atomic_count_win32.hpp in operator-- (BOOST_INTERLOCKED_DECREMENT)
Unhandled exception at 0x010752b9 in fly2.exe: 0xC0000005: Access
violation writing location 0x00779040.
There is still the anomaly of release version being slower than debug.
Compiled as release - the exception occurs in xmemory in _Destroy_range.
I'll experiment using set_factory in Borland - although I have largely
abandoned it's use, just can't compile enough of Boost to be useful now...
Martin