Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • eigen eigen
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 687
    • Issues 687
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Custom issue tracker
    • Custom issue tracker
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • libeigenlibeigen
  • eigeneigen
  • Issues
  • #912
Closed
Open
Issue created Dec 04, 2019 by Eigen Bugzilla@eigenbzReporter

Create a Ptr<> analogon to Ref<>

Submitted by Christoph Hertzberg @chhtz

Assigned to Nobody

Link to original bugzilla bug (#912)
Version: 3.3 (current stable)

Description

Ref<> (similar to Map) has the disadvantage that once initialized its reference can't be changed (without a placement-new hack). This is similar to C++ references.
An idea is to add the analogon of a pointer, which can be uninitialized (a NULL pointer) or which can be re-initialized at any time.

For reinitialization operator=(const DenseBase<...>&) can be overloaded.

Alternatively, we could overload operator& for DirectAccess types to return a Ptr object.
Ptr<MatrixXd> A = & M.block(...); // with overloaded operator&
vs
Ptr<MatrixXd> A = M.block(...); // without overloading

But overloading & is very often causing trouble.

For fixed sized Ptr<> objects, initialization by a Scalar* could be considered:
Ptr<Matrix3d> B = data;

To access the referenced data, operator* and operator-> can be overloaded. Furthermore, operator! and operator bool can be overloaded to check if the pointer is NULL or not.

Depends on

#884

Blocking

#1608

Edited Dec 05, 2019 by Eigen Bugzilla
Assignee
Assign to
Time tracking