I NEED HEMP PLEASEeeeeeeeeeeeeee

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

I NEED HEMP PLEASEeeeeeeeeeeeeee

Karim Bakir
 
I use multi array boost
 
But I have problem : - I can't  declare  a multi array as a member variable , I have the error: unexpected "error C2321: syntax error : unexpected 'boost::extents"
When I don'  write the keyword "typdef"  I have  more mistakes.
 
//Boost library
#include <Boost/multi_array.hpp>
#include <cassert>
//Name Space
using namespace std;
using namespace boost;
class MyClass 
{
 typedef boost::multi_array<double,2>array_type_2d;
 
public:

 MyClass();
 virtual ~MyClass();
 array_type_2d M(boost::extents[10][10]);
 
};
 
 
 
So I want to have  : but I don't manage it.
//myClass.h
//////////////////////////
//Boost library
#include <Boost/multi_array.hpp>
#include <cassert>
//Name Space
using namespace std;
using namespace boost;
class myClass
{
boost::multi_array<double,2>array_type_2d;
 
private :
int  dim1, dim2;
array_type_2d MyMatrice(boost::extents[dim1][dim2]) ;
array_type_2d MySecondMatrice(boost::extents[10][10]) ;
};
 
 
//myClass.cpp
////////////////////////////////
 
void myClass::tester()
{
for (int  i= 0 ; i<dim1; +)
    for(int j=0;j<dim2;j++)
        MyMatrice[i][j] = 15;
}
 
for (  i= 0 ; i<10; +)
    for(int j=0;j<10;j++)
        MySecondMatrice[i][j] = 0;
}
 
 
Thankssss

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: I NEED HEMP PLEASEeeeeeeeeeeeeee

Sohail Somani
I don't think this is the right list to discuss these things.

(Sorry, I had to)
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: I NEED HEMP PLEASEeeeeeeeeeeeeee

Jeff Flinn
In reply to this post by Karim Bakir
You will get a better response if you use an appropriate subject line:

[multi_array] error using vc7.1 and boost 1.33.1

Jeff Flinn



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: I NEED HEMP PLEASEeeeeeeeeeeeeee

Bronek Kozicki
Jeff Flinn wrote:
> You will get a better response if you use an appropriate subject line:

... and refrain from using HTML in your message body


B.
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

[multi-array] [C++ 101] How to write a class (was: I NEED HEMP PLEASEeeeeeeeeeeeeee)

Daryle Walker
In reply to this post by Karim Bakir
On 4/5/06 4:48 PM, "Karim Bakir" <[hidden email]> wrote:

You should first start by putting in a descriptive subject to your message.
A generic "help" sentence, especially one that is misspelled and
over-emphasized, is no good.  Also, since Boost covers a lot of different
code subjects, you should add a tag to the subject specifying the library
you have a problem with.

> I use multi array boost
>
> But I have problem : - I can't  declare  a multi array as a member variable ,
> I have the error: unexpected "error C2321: syntax error : unexpected
> 'boost::extents"
> When I don'  write the keyword "typdef"  I have  more mistakes.

The actual problem isn't with multi-array; it's that you can't write a
class.

>
> //Boost library
> #include <Boost/multi_array.hpp>
> #include <cassert>
> //Name Space
> using namespace std;
> using namespace boost;
> class MyClass  
> {
> typedef boost::multi_array<double,2>array_type_2d;
>
> public:
>
> MyClass();
> virtual ~MyClass();
> array_type_2d M(boost::extents[10][10]);
>
> };
[TRUNCATE]

Data-based members generally cannot be initialized at the declaration level
within the class definition.  (The exception is for static data member
constants of an integer or enumeration type, and they must use the "= Value"
syntax.)  You should initialize non-static data members within each
constructor, hopefully within the initializer list, or within the body if
you must.  Static data members that don't meet the exception given above
have to be initialized like a regular variable, but outside the class
definition.

//========================================================================
class MyClass2
{
    boost::multi_array<double, 2>  M;

    static const std::size_t  sz = 10u;

    static float  count;

public:
    MyClass2()
        : M( boost::extents[sz][sz] )
    {
        ++count;
    }

    virtual ~MyClass2()  { --count; }
};

float  MyClass2::count( 0.0f );
//========================================================================

--
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users