* manual on-line and Q
@ 2002-06-25 3:59 Martín Marqués
2002-06-25 4:21 ` Angus Leeming
2002-06-25 4:22 ` Thomas Porschberg
0 siblings, 2 replies; 3+ messages in thread
From: Martín Marqués @ 2002-06-25 3:59 UTC (permalink / raw)
To: gcc-help
I would like to know which is a good manual for not so newbie C/C++ programmer
(with info about math functions, etc.), and a Q I have.
How do I concatenate into strings other data types, like double or int?
--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
MartÃn Marqués | mmarques@unl.edu.ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: manual on-line and Q
2002-06-25 3:59 manual on-line and Q Martín Marqués
@ 2002-06-25 4:21 ` Angus Leeming
2002-06-25 4:22 ` Thomas Porschberg
1 sibling, 0 replies; 3+ messages in thread
From: Angus Leeming @ 2002-06-25 4:21 UTC (permalink / raw)
To: Martín Marqués, gcc-help
On Tuesday 25 June 2002 11:59 am, MartÃn Marqués wrote:
> I would like to know which is a good manual for not so newbie C/C++
> programmer (with info about math functions, etc.), and a Q I have.
>
> How do I concatenate into strings other data types, like double or int?
Try this GPL-ed code from the LyX project (www.lyx.org)
Angus
/// convert \a T to string
template<typename T>
inline
string const tostr(T const & t)
{
ostringstream ostr;
ostr << t;
return ostr.str().c_str();
// We need to use the .c_str since we sometimes are using
// our own string class and that is not compatible with
// basic_string<char>. (of course we don't want this later)
}
///
template<>
inline
string const tostr(bool const & b)
{
return (b ? "true" : "false");
}
///
template<>
inline
string const tostr(string const & s)
{
return s;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: manual on-line and Q
2002-06-25 3:59 manual on-line and Q Martín Marqués
2002-06-25 4:21 ` Angus Leeming
@ 2002-06-25 4:22 ` Thomas Porschberg
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Porschberg @ 2002-06-25 4:22 UTC (permalink / raw)
To: Martín Marqués; +Cc: gcc-help
On Tue, Jun 25, 2002 at 07:59:51AM -0300, MartÃn Marqués wrote:
> I would like to know which is a good manual for not so newbie C/C++ programmer
> (with info about math functions, etc.), and a Q I have.
I'am happy with the books by Scott Meyers:
http://www.aristeia.com/books_frames.html
Sorry for advertising.
>
> How do I concatenate into strings other data types, like double or int?
May be http://www.boost.org/libs/conversion/index.htm helps.
example:
#include <boost/lexical_cast.hpp>
using std::string;
using boost::lexical_cast;
string dummy = string("bla") + lexical_cast<string>(myInteger) + string(")");
thomas
>
> --
> Porqué usar una base de datos relacional cualquiera,
> si podés usar PostgreSQL?
> -----------------------------------------------------------------
> MartÃn Marqués | mmarques@unl.edu.ar
> Programador, Administrador, DBA | Centro de Telematica
> Universidad Nacional
> del Litoral
> -----------------------------------------------------------------
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-06-25 11:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-25 3:59 manual on-line and Q Martín Marqués
2002-06-25 4:21 ` Angus Leeming
2002-06-25 4:22 ` Thomas Porschberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).