Skip to content

Commit

Permalink
Deny T* as an AutoFilter argument.
Browse files Browse the repository at this point in the history
Added a specialization for T* in auto_arg which requires (via static_assert) that T is const-qualified.  This is required for input semantics.  T* is not allowed as an output parameter.
  • Loading branch information
Victor 'Yes, The Victor' Dods committed Jun 11, 2015
1 parent e7dfaed commit d8da367
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 d8da367

Please sign in to comment.