Initial Commit
This commit is contained in:
2
examples/navigation/docs/notes.md
Normal file
2
examples/navigation/docs/notes.md
Normal file
@@ -0,0 +1,2 @@
|
||||
Search for increment, then exclude docs/ to remove this documentation result.
|
||||
Code navigation still indexes the entire active build configuration.
|
||||
19
examples/navigation/main.cpp
Normal file
19
examples/navigation/main.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "numbers.hpp"
|
||||
|
||||
template <Addable T>
|
||||
T twice(T value) {
|
||||
return value + value;
|
||||
}
|
||||
|
||||
// This branch syntax requires C++23.
|
||||
constexpr int evaluation_mode() {
|
||||
if consteval {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
return increment(twice(20)) + evaluation_mode();
|
||||
}
|
||||
2
examples/navigation/meson.build
Normal file
2
examples/navigation/meson.build
Normal file
@@ -0,0 +1,2 @@
|
||||
project('cex-navigation-demo', 'cpp', default_options: ['cpp_std=c++23'])
|
||||
executable('navigation-demo', 'main.cpp', 'numbers.cpp')
|
||||
5
examples/navigation/numbers.cpp
Normal file
5
examples/navigation/numbers.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "numbers.hpp"
|
||||
|
||||
int increment(int value) {
|
||||
return value + 1;
|
||||
}
|
||||
10
examples/navigation/numbers.hpp
Normal file
10
examples/navigation/numbers.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// Try References on Addable: its constraint is used in main.cpp.
|
||||
template <typename T>
|
||||
concept Addable = requires(T value) {
|
||||
value + value;
|
||||
};
|
||||
|
||||
// Try Definition or Callers on increment.
|
||||
int increment(int value);
|
||||
Reference in New Issue
Block a user