Skip to content

Instantly share code, notes, and snippets.

@mitchute
Created April 21, 2016 18:34
Show Gist options
  • Save mitchute/ce93add24282ee493f6e0dcd51e98c73 to your computer and use it in GitHub Desktop.
Save mitchute/ce93add24282ee493f6e0dcd51e98c73 to your computer and use it in GitHub Desktop.
// header.hh
class cell // cell class
{
public:
double x_loc;
};
class BaseDomainClass
{
public:
// BaseDomain Members
std::vector< std::unique_ptr< cell >> cellVect;
// BaseDomain functions
std::unique_ptr< cell > getCell( int i, int j );
};
// In main.cc
std::unique_ptr< cell >BaseDomainClass::getCell(
int const i,
int const j
)
{
int vectorIndex = i + j;
return cellVect[ vectorIndex ];
}
@Myoldmopar
Copy link

#include <vector>

class cell // cell class
{
public:
    double x_loc;
};

class BaseDomainClass
{
public:

    // BaseDomain Members
    std::vector< cell * > cellVect;

    // BaseDomain functions
    cell * getCell( int const i, int const j );

};


// In main.cc

cell * BaseDomainClass::getCell(
    int const i,
    int const j
)
{
    int vectorIndex = i + j;
    return cellVect[ vectorIndex ];
}


int main() {
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment