Project

General

Profile

Cleanup #1833

Cleanup SDAG Closure refnum handling with enable_if

Added by Sam White 7 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
03/17/2018
Due date:
% Done:

0%


Description

The SDAG code has this in a comment:

      // Handles refnum setting for generated code by allowing calls to setRefnum
      // regardless of the type of the first parameter to an entry method
      // TODO: With C++11 support, remove overloading in favor of enable_if
      template <typename T>
      inline void setRefnum(T t) {}
      inline void setRefnum(char c) { hasRefnum = true; refnum = c; }
      inline void setRefnum(int i) { hasRefnum = true; refnum = i; }
      inline void setRefnum(short s) { hasRefnum = true; refnum = s; }
      inline void setRefnum(long l) { hasRefnum = true; refnum = l; }
      inline void setRefnum(unsigned char c) { hasRefnum = true; refnum = c; }
      inline void setRefnum(unsigned int i) { hasRefnum = true; refnum = i; }
      inline void setRefnum(unsigned short s) { hasRefnum = true; refnum = s; }
      inline void setRefnum(unsigned long l) { hasRefnum = true; refnum = l; }
      inline void setRefnum(float f) { hasRefnum = true; refnum = f; }
      inline void setRefnum(double d) { hasRefnum = true; refnum = d; }
      void unsetRefnum() { hasRefnum = false; refnum = 0; }

Also available in: Atom PDF