Skip to content

Some comments #58

@uselessgoddess

Description

@uselessgoddess
  • use C++ type style:
    - Type& val
    - Type* val
  • use std::move for forward std::string (and other big [not fundamental] types)
  constructor(std::string string)
      : field(std::move(string)) 
  • use const & for [big type] argument
  • use universal reference to forward template argument
  • use std::forward to forward template argument
auto function(std::vector<big_type>& list, big_type case1, const big_type& case2, auto&& case3)
{
    list.push_back(std::move(case1)) // one copy/only move, but call function(list, std::move(val), ..., ...)
    list.push_back(case2) // always one copy
    list.push_back(std::forward<decltype(case3)>(case3)) // same case1 but have other features
}
auto function(big_type case1, const big_type& case2, auto&& case3)
{
    case1.readonly_func() // (( always one copy 
    case2.readonly_func() // )) no copy
    case3.readonly_func() // )) no copy
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingperformanceThis can be done faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions