-
Couldn't load subscription status.
- Fork 4.3k
created new entry for pop_front() under deque. #7723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Radhika-okhade
merged 6 commits into
Codecademy:main
from
RishitModi:new_term_entry_pop_front
Oct 22, 2025
+81
−0
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4928d15
docs updated,created new entry for pop_front() under deque.
RishitModi c05a142
minor updates
mamtawardhani a8e9649
Merge branch 'main' into new_term_entry_pop_front
mamtawardhani 058e1bb
Merge branch 'main' into new_term_entry_pop_front
Radhika-okhade 26e0120
Update content/cpp/concepts/deque/terms/pop-front/pop-front.md
Radhika-okhade 92ccfc3
Update content/cpp/concepts/deque/terms/pop-front/pop-front.md
Radhika-okhade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| Title: 'pop_front()' | ||
| Description: 'Removes the first element from a deque container in C++.' | ||
| Subjects: | ||
| - 'Computer Science' | ||
| - 'Game Development' | ||
| Tags: | ||
| - 'Containers' | ||
| - 'Deque' | ||
| - 'Methods' | ||
| - 'STL' | ||
| CatalogContent: | ||
| - 'learn-c-plus-plus' | ||
| - 'paths/computer-science' | ||
| --- | ||
|
|
||
| The **`pop_front()`** method in C++ deque removes the first (front) element from the deque, reducing its size by one. | ||
Radhika-okhade marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Syntax | ||
|
|
||
| ```pseudo | ||
| deque_name.pop_front(); | ||
| ``` | ||
|
|
||
| **Parameters:** | ||
|
|
||
| This method does not take any parameters. | ||
|
|
||
| **Return value:** | ||
|
|
||
| `pop_front()` does not return anything and removes the first element from the deque | ||
|
|
||
| ## Example | ||
|
|
||
| In this example, the first element of an integer deque is removed, and the updated deque is printed: | ||
|
|
||
| ```cpp | ||
| #include <iostream> | ||
| #include <deque> | ||
| using namespace std; | ||
|
|
||
| int main() { | ||
| deque<int> numbers = {10, 20, 30, 40}; | ||
|
|
||
| // Remove the first element | ||
| numbers.pop_front(); // Removes 10 | ||
|
|
||
| cout << "Deque after pop_front(): "; | ||
| for (int num : numbers) { | ||
| cout << num << " "; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
| ``` | ||
|
|
||
| The output of this code is: | ||
|
|
||
| ```shell | ||
| Deque after pop_front(): 20 30 40 | ||
| ``` | ||
|
|
||
| ## Codebyte Example | ||
|
|
||
| In this example, the first element of a string deque is removed, and the new front element is displayed: | ||
|
|
||
| ```codebyte/cpp | ||
| #include <iostream> | ||
| #include <deque> | ||
| using namespace std; | ||
|
|
||
| int main() { | ||
| deque<string> names = {"Alice", "Bob", "Charlie"}; | ||
|
|
||
| // Removes the first element | ||
| names.pop_front(); // Removes "Alice" | ||
|
|
||
| cout << "Front element after pop_front(): " << names.front() << endl; | ||
| return 0; | ||
| } | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.