Skip to content

Using Class Template Argument Deduction (CTAD) to remove redundant template parameters #267

Description

@vkpatel186

Describe the goal of the feature

Since dd-trace-cpp requires C++17, we can take advantage of Class Template Argument Deduction (CTAD) to remove redundant template arguments at call sites and improve readability.

The goal is to:
Reduce verbosity for obvious template instantiations (e.g. RAII guard types)
Improve code clarity without changing behavior, ABI, or public APIs
Keep changes scoped and low-risk (primarily in implementation files)

Example:

// Current
std::lock_guard<std::mutex> lock(m);

// With CTAD
std::lock_guard lock(m);

Similarly, CTAD could be enabled for internal Datadog template types where the template parameter is unambiguously deducible from the constructor arguments.

This would be a purely syntactic improvement:
No behavioral changes
No API breakage
No impact on users, since C++17 is already required

I’m relatively new to contributing to open source projects and, after a recent interaction with someone from Datadog, became interested in contributing to dd-trace-cpp Working on this feature would also help me learn more about the codebase while making a small, safe improvement. If this direction sounds reasonable, I’d be happy to submit a PR starting with limited, internal usage.

Is your feature request related to a problem?

No response

Describe alternatives you've considered

No response

Additional context

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions