Re: Read conditional function parameters during compile time using __traits

2017-06-23 Thread timvol via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 20:48:52 UTC, ag0aep6g wrote: On 06/21/2017 09:39 PM, timvol wrote: size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode == 1 ) { return 10; // More complex calculated value } size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode ==

Re: Read conditional function parameters during compile time using __traits

2017-06-21 Thread ag0aep6g via Digitalmars-d-learn
On 06/21/2017 09:39 PM, timvol wrote: size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode == 1 ) { return 10; // More complex calculated value } size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode == 2 ) { return 20; // More complex calculated value

Re: Read conditional function parameters during compile time using __traits

2017-06-21 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 19:39:14 UTC, timvol wrote: Hi! I've a simple array of bytes I received using sockets. What I want to do is to calculate the target length of the message. So, I defined a calcLength() function for each function code (it's the first byte in my array). My problem is

Read conditional function parameters during compile time using __traits

2017-06-21 Thread timvol via Digitalmars-d-learn
Hi! I've a simple array of bytes I received using sockets. What I want to do is to calculate the target length of the message. So, I defined a calcLength() function for each function code (it's the first byte in my array). My problem is that I defined the calcLength() function using conditions