Skip to content

Commit

Permalink
Merge pull request #552 from leapmotion/vdods-auto_arg-const-ptr
Browse files Browse the repository at this point in the history
Deny T* as an AutoFilter argument.
  • Loading branch information
codemercenary committed Jun 11, 2015
2 parents e7dfaed + d8da367 commit 59e126f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions autowiring/auto_arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,29 @@ class auto_arg<std::shared_ptr<const T>>
}
};

/// <summary>
/// Specialization for "T*" ~ auto_in<T*>. T must be const-qualified in order to be an input parameter.
/// </summary>
template<class T>
class auto_arg<T*>
{
public:
static_assert(std::is_const<T>::value, "Pointer-typed input parameters must point to a const-qualified type (T must be const-qualified)");
typedef T* type;
typedef T* arg_type;
typedef auto_id<T*> id_type;
static const bool is_input = true;
static const bool is_output = false;
static const bool is_shared = false;
static const bool is_multi = false;
static const int tshift = 0;

template<class C>
static const T* arg(C& packet) {
return packet.template Get<const T*>();
}
};

/// <summary>
/// Specialization for equivalent T auto_in<T>
/// </summary>
Expand Down

0 comments on commit 59e126f

Please sign in to comment.