Fast way to add null after each char37193 (9/5/2010 4:54:28 PM) comp.lang.c++ std::string s = "easy";
std::string unicode_string;
std::string::const_iterator it,
for(it = s.begin(); it != s.end(); ++it)
{
unicode_string.push_back(*it);
unicode_string.push_back('\0');
}
... Brad
std::queue and memory3269 (8/9/2010 12:12:10 PM) comp.lang.c++ Before getting into the details, I'll start by saying that I've never
had need to use new and delete much before now and all the examples I
read about new/delete use types such as int and char. So if some of ... Brad
Predictably Breaking Up a Cartesian Product9120 (7/15/2010 3:20:16 PM) comp.lang.c++ Here is some code I wrote that breaks up a Cartesian Product. It
compiles and runs fine:
#include
#include
void cartesian_product( const std::string& my_string, int b1, int e1 )
{
std::string::co... Brad
Handling Strings8127 (6/28/2010 3:11:32 PM) comp.lang.c++ Some third-party libraries I use require byte arrays, some char arrays
some std::strings. Normally, when taking user defined input that is
suitable as a string, I use std::string, but find myself casting a lo... Brad
Comparing Multiple Strings More Efficiently17127 (6/21/2010 4:34:18 PM) comp.lang.c++.moderated I think there are better (more efficient) ways to do this, but I've
only ever needed this simple approach:
void compare(const std::vector& strings)
{
// Normally, this is randomly generated. It i... Brad
Python multimap1221 (8/27/2008 1:35:34 PM) comp.lang.python Recently had a need to us a multimap container in C++. I now need to write equivalent Python code. How does Python handle this? k['1'] = 'Tom' k['1'] = 'Bob' k['1'] = 'Joe' .... Same key, but different value... brad
regex search loops instead of findall121 (8/5/2008 6:06:04 PM) comp.lang.python Hi guys... I'm trying to make my Python regex code behave like my C++ regex code. In order to search large strings for *all* occurrences of the thing I'm searching for, I loop like this in C++: void number_... brad
Looking for lots of words in lots of files920 (6/18/2008 2:28:38 PM) comp.lang.python Just wondering if anyone has ever solved this efficiently... not looking for specific solutions tho... just ideas. I have one thousand words and one thousand files. I need to read the files to see if some of... brad
Wrapping C with Python821 (8/4/2008 11:12:03 AM) comp.lang.python Hi!! I tried wrapping a simple C code suing SWIG to Python, but am having problem, my .c file is, Step 1: example.c -------------- double val=3.0; int fact(int n) { if(n swig - python example.i It creates exam... anishchapagain(22)
What Python looks like1331 (8/4/2008 7:06:58 PM) comp.lang.python Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing Python. I'm cur... israelu(152)
Suggestion for converting PDF files to HTML/txt files515 (8/11/2008 12:51:18 PM) comp.lang.python Could someone suggest me ways to convert PDF files to HTML files?? Does Python have any modules to do that job?? Thanks, Srini=0A=0A=0A Unlimited freedom, unlimited storage. Get it now, on ht= tp://help.y... sri_annauni(56)
Python multimap1221 (8/27/2008 1:35:34 PM) comp.lang.python Recently had a need to us a multimap container in C++. I now need to write equivalent Python code. How does Python handle this? k['1'] = 'Tom' k['1'] = 'Bob' k['1'] = 'Joe' .... Same key, but different value... byte8bits(134)
Comparing Multiple Strings More Efficiently9116 (6/21/2010 4:07:45 PM) comp.lang.c++ I think there are better (more efficient) ways to do this, but I've
only ever needed this simple approach:
void compare(const std::vector& strings)
{
// Normally, this is randomly generated. It is... Brad
Predictably Breaking Up a Cartesian Product9120 (7/15/2010 3:20:16 PM) comp.lang.c++ Here is some code I wrote that breaks up a Cartesian Product. It
compiles and runs fine:
#include
#include
void cartesian_product( const std::string& my_string, int b1, int e1 )
{
std::string::co... byte8bits(134)
Does a function know where it was called from?17136 (9/8/2010 8:49:55 PM) comp.lang.c++ Is there a way in standard C++ for a function to determine where it
was called from? For example.
add(int x, int y)
{
std::cout << "Called by: " << what_function? << std::endl;
return x + y;
}
... Brad