<p>Is there a way to have the compile deduce the template parameter automatically?</p>

<pre><code>template&lt;class T&gt; 
struct TestA 
{
    TestA(T v) {} 
};
template&lt;class T&gt;
void TestB(T v)
{
}
int main()
{
    TestB (5);
}
</code></pre>

<p>Test B works fine, however when i change it to TestA it will not compile with the error " use of class template requires template argument list"</p>

No, there isn't. Class templates are never deduced. The usual pattern is to have a
```
make_
```
free function:
```
```
template<class T> TestA<T> make_TestA(T v)
{
    return TestA<T>(v);
}
```
```
See
```
std::pair
```
and
```
std::make_pair
```
, for example.
In C++0x you will be able to do
```
```
auto someVariable = make_TestA(5);
```
```
to avoid having to specify the type for local variables.