Thanks Steven,
 
      Didn't mean to snip that out.. I overlooked it as just a warning. So here is the updated code.
 
#include <boost/static_assert.hpp>
template<class T = int, std::size_t N = 3>
class C {
public:
   C() {assign(0)}
   C(const T& i0) {
       BOOST_STATIC_ASSERT(N == 1);
       m_data[0] = i0;
   }
   C(const T& i0, const T& i1) {
      BOOST_STATIC_ASSERT(N==2);
      m_data[0] = i0;
      m_data[1] = i1;
   }
   const_iterator begin() const {return m_data;}
   const_iterator end() const {return m_data + N;}
   void assign(const T& value) {std::fill_n(begin(), size(), value);}
   static size_t size() {return N;}
   ...
   ...
private:
   T m_data[N];
};
typedef C<> my_C;
 
   Apologies... but I am unable to see what the MS VC++ 2010 compiler doesn't like about this..

Thanks for pointing this out,
--Sunil.
On Wed, Nov 2, 2011 at 5:36 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG

On 11/02/2011 04:32 PM, Sunil Thomas wrote:
> Thanks Steve & Nate,
>
>    What I am building is a library.. not a main application. My main
> application is in unit test libraries. But building the
> library itself is generating the error. The class and its implementation is
> defined entirely in the header, say, cinc.h
> and I forgot to include a typedef after the class definition:
>
> <snip>
>           <path/to>/cinc.hpp(255) : while compiling class template member
> function 'void C<>::assign(const unsigned __int64 &)'
> <path/to>/cinc.hpp(83): error C2338: N==1*
>

You've snipped something important.
I don't see a definition of assign
in your code.  Figure out how and
why assign is called with 1 argument
and that should explain why your
code doesn't compile.

>
>     I don't see myself doing anything different than what Steve did in his
> main.. and again, why was this building with
> MSVC++ 2008 (granted, that N defaults to 3 and all)? Anyways, hope this was
> more helpful.
>

In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users