On Tuesday, November 03, 2015 07:35:40 Nordlöw via Digitalmars-d-learn wrote:
> On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis
> wrote:
> > You should pretty much never use __FILE__ or __LINE__ as
> > template arguments unless you actually need to. The reason is
> > that it will end
On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis
wrote:
You should pretty much never use __FILE__ or __LINE__ as
template arguments unless you actually need to. The reason is
that it will end up creating a new instantiation of the
template pretty much every time that it's used,
On Monday, November 02, 2015 00:36:14 anonymous via Digitalmars-d-learn wrote:
> On 01.11.2015 23:49, Adam D. Ruppe wrote:
> > Yeah, just make the other args normal runtime instead of template:
>
> Or make it two nested templates:
>
> template show(T ...)
> {
> void show(string file =
On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis
wrote:
You should pretty much never use __FILE__ or __LINE__ as
template arguments unless you actually need to. The reason is
that it will end up creating a new instantiation of the
template pretty much every time that it's used,
On Sunday, 1 November 2015 at 23:36:15 UTC, anonymous wrote:
On 01.11.2015 23:49, Adam D. Ruppe wrote:
Yeah, just make the other args normal runtime instead of
template:
Or make it two nested templates:
template show(T...)
{
void show(string file = __FILE__, uint line = __LINE__,
On Monday, 2 November 2015 at 09:02:28 UTC, Gary Willoughby wrote:
On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote:
I need `T` to be an alias in order for .stringof to work.
typeof(T).stringof
No, I want the variable name from the calling scope.
This works for a single argument.
On Monday, 2 November 2015 at 09:16:09 UTC, Nordlöw wrote:
On Monday, 2 November 2015 at 09:02:28 UTC, Gary Willoughby
wrote:
On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote:
I need `T` to be an alias in order for .stringof to work.
typeof(T).stringof
No, I want the variable name
On Monday, 2 November 2015 at 09:54:50 UTC, John Colvin wrote:
Why can't I make Args a sequence of aliases?
Works for me on multiple compilers. To be precise, this worked:
Except it prints Arg instead of x, try:
debug write(Args[i].stringof, " is ", Arg);
On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote:
I need `T` to be an alias in order for .stringof to work.
typeof(T).stringof
On Monday, 2 November 2015 at 09:54:50 UTC, John Colvin wrote:
Works for me on multiple compilers. To be precise, this worked:
template show(Args...)
{
void show(string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__)()
{
import std.stdio: write, writeln;
On Monday, 2 November 2015 at 11:44:45 UTC, Daniel N wrote:
On Monday, 2 November 2015 at 11:36:27 UTC, Nordlöw wrote:
I want it to print the name of Arg in the closing as
x is 11
See my previous comment:
Arg -> Args[i].stringof
Ahh! Great! Thx!
On Monday, 2 November 2015 at 11:36:27 UTC, Nordlöw wrote:
I want it to print the name of Arg in the closing as
x is 11
See my previous comment:
Arg -> Args[i].stringof
On 01.11.2015 23:49, Adam D. Ruppe wrote:
Yeah, just make the other args normal runtime instead of template:
Or make it two nested templates:
template show(T ...)
{
void show(string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__)()
{
...
}
}
Is it possible to make the following definition
void show(alias T, string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__)()
{
import std.stdio: writeln;
try { debug writeln(file, ":",line, ":" /* , ": in ",fun */,
" debug: ", T.stringof, ":", T); }
catch
Yeah, just make the other args normal runtime instead of template:
void show(T...)(string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__) {
// same body
}
// same usage
15 matches
Mail list logo