Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Should we pass UUIDs (and maybe other objects) as const reference? #34

Closed
@Jeroen88

Description

@Jeroen88

I did a small experiment, changing in BLEClient this function BLERemoteService * getService(const BLEUUID &uuid), so I passed a const reference instead of the object. This lead to having to change in BLEUUID the function std::string toString() const, because the compiler complaint about passing a non-const this parameter.

In a very small program this saved 12 bytes of code, not a lot. BUT this should have a great positive impact on performance, because now not the full object is copied onto the stack, but just a reference (pointer) to it.

I think it is a lot of work, to change all relevant class member functions, but I think it is worth the effort, if there are no negative side effects. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions