On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote:
There's a much more concise workaround, both in code written
and generated ;)
import std.stdio;
template func(string file = __FILE__, int line = __LINE__)
{
auto func(T...)(auto ref T args)
{
writeln("called fun
On Monday, 17 April 2017 at 14:23:50 UTC, Jonathan M Davis wrote:
On Monday, April 17, 2017 13:45:18 Dmitry via
Digitalmars-d-learn wrote:
[...]
Every time there's a new template instantiation, it's
essentially copy-pasting the entire template. So, if you have
the templated function
[...]
On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote:
On Tuesday, 18 April 2017 at 13:28:06 UTC, Solomon E wrote:
I tried to produce an example of calling a function with
variadic template arguments using special tokens __FILE__ and
__LINE__.
This compiles and runs, producing th
On Tuesday, 18 April 2017 at 13:28:06 UTC, Solomon E wrote:
I tried to produce an example of calling a function with
variadic template arguments using special tokens __FILE__ and
__LINE__.
This compiles and runs, producing the output shown, using the
default gdc
provided by Ubuntu 17.04. Thi
On Tuesday, 18 April 2017 at 10:13:09 UTC, Jonathan M Davis wrote:
On Monday, April 17, 2017 07:23:50 Jonathan M Davis via
Digitalmars-d-learn wrote:
So, if you're okay with explicitly instantiating your variadic
function template instead of having the types inferred, then
it can work, but othe
On Monday, April 17, 2017 07:23:50 Jonathan M Davis via Digitalmars-d-learn
wrote:
> So, if you're okay with explicitly instantiating your variadic function
> template instead of having the types inferred, then it can work, but
> otherwise, no. Making it work would require a language enhancement
On Monday, 17 April 2017 at 14:23:50 UTC, Jonathan M Davis wrote:
So, if you're okay with explicitly instantiating your variadic
function template instead of having the types inferred, then it
Yes, it's my case. That's a game engine, so some kilobytes isn't
a problem.
Moreover, possible that fu
On Monday, April 17, 2017 13:45:18 Dmitry via Digitalmars-d-learn wrote:
> On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote:
> > They works, but it results in a new template being instantiated
> > for every call, so you really shouldn't use __FILE__ or
> > __LINE__ as template argum
On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote:
They works, but it results in a new template being instantiated
for every call, so you really shouldn't use __FILE__ or
__LINE__ as template arguments if you can avoid it.
Does it matter if I anyway use template (S...) ?
And what
On Monday, April 17, 2017 10:58:36 Basile B. via Digitalmars-d-learn wrote:
> On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote:
> > On Monday, April 17, 2017 10:30:35 Basile B. via
> >
> > Digitalmars-d-learn wrote:
> >> On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote:
> > vo
On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote:
On Monday, April 17, 2017 10:30:35 Basile B. via
Digitalmars-d-learn wrote:
On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote:
void error(string msg, string file = __FILE__, size_t line =
__LINE__)
{
...
}
That's what
On Monday, April 17, 2017 10:30:35 Basile B. via Digitalmars-d-learn wrote:
> On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote:
> > Hi there.
> >
> > Currently for messages about errors I use code like this:
> > void add(string name, ref Scene scene)
> > {
> >
> > if (name in
On Monday, 17 April 2017 at 10:30:35 UTC, Basile B. wrote:
when used as template value parameter, __FILE__ and
__LINE__evaluate to the file and line of the call site. So help
yourself ans use something like this:
void error(string f = __FILE__, int l = __LINE__)(string msg){}
Thank you, Basi
On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote:
Hi there.
Currently for messages about errors I use code like this:
void add(string name, ref Scene scene)
{
if (name in listOfScenes)
{
EError(__FILE__, __LINE__, "scene already
exists".L, quoted(name)
Hi there.
Currently for messages about errors I use code like this:
void add(string name, ref Scene scene)
{
if (name in listOfScenes)
{
EError(__FILE__, __LINE__, "scene already exists".L,
quoted(name));
}
...
}
Is there way for avoid using
15 matches
Mail list logo